# HG changeset patch # User Stephen Talley # Date 1331736315 14400 # Node ID 8a6fba4105d706996c5771565bd985b1fee1cb31 # Parent 2122a04679c0ce840b4d0d0d918fa5b13509c9bd 7150175 radadrgen should generate rad module man pages 7150179 radadrgen should validate against original rng schema 7150184 radadrgen's output doesn't conform to docbook schema 7150189 adr schema should support documentation markup for union arms 7150226 radadrgen transforms should be internationalized 7150292 radadrgen -c should take a directory name, like -j 7150294 radadrgen command line usage should be broken into multiple synopses 7150352 radadrgen -o text should be revisited 7106700 radadrgen man page lacks documentation, -N, -m options diff -r 2122a04679c0 -r 8a6fba4105d7 .hgignore --- a/.hgignore Wed Mar 14 04:47:00 2012 -0700 +++ b/.hgignore Wed Mar 14 10:45:15 2012 -0400 @@ -26,9 +26,9 @@ build_wos/.* ^proto.* ^packages.* +^usr/src/cmd/rad/daemon/rad$ ^usr/src/cmd/rad/mod/proto_rad/protocol_xdr.c$ ^usr/src/cmd/rad/mod/proto_rad/protocol.h$ -^usr/src/cmd/rad/daemon/rad$ ^usr/src/cmd/radcli/radcli$ ^usr/src/cmd/radconsole/radconsole$ ^usr/src/cmd/radpipe/radpipe$ @@ -36,9 +36,9 @@ ^usr/src/cmd/setpass/setpass$ ^usr/src/cmd/test/libadr/name$ ^usr/src/cmd/zmgr/zmgr$ -^usr/src/doc/manpage/.*\.1m?$ +^usr/src/doc/manpage/.*\.(1m?|3rad)$ +^usr/src/doc/rad-dev/.*-proc.xml$ ^usr/src/doc/rad-dev/rad-devguide.html$ -^usr/src/doc/rad-dev/.*-proc.xml$ ^usr/src/java/vpanels/java.policy$ ^usr/src/java/vpanels/vp$ ^usr/src/lib.*_jni/.*\.h diff -r 2122a04679c0 -r 8a6fba4105d7 usr/src/Makefile --- a/usr/src/Makefile Wed Mar 14 04:47:00 2012 -0700 +++ b/usr/src/Makefile Wed Mar 14 10:45:15 2012 -0400 @@ -20,20 +20,20 @@ # # -# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. # include $(SRC)/Makefile.env java: tools -cmd lib: java -cmd: lib -doc: cmd lib java +lib: java +cmd: java lib +doc: java lib cmd publish := TARGET = publish publish: pkg -test: lib cmd java +test: java lib cmd qinstall: $(MAKE) install ANT='ant -Dquick=true' diff -r 2122a04679c0 -r 8a6fba4105d7 usr/src/Makefile.env --- a/usr/src/Makefile.env Wed Mar 14 04:47:00 2012 -0700 +++ b/usr/src/Makefile.env Wed Mar 14 10:45:15 2012 -0400 @@ -84,6 +84,7 @@ CHMOD = /usr/bin/chmod CP = /usr/bin/cp EGREP = /usr/bin/egrep +ENV = /usr/bin/env FIND = /usr/bin/find GREP = /usr/bin/grep GTAR = /usr/sfw/bin/gtar @@ -106,6 +107,7 @@ XARGS = /usr/bin/xargs PYTHON = /usr/bin/python TOUCH = /usr/bin/touch +TRUE = /usr/bin/true CTFMERGE = /opt/onbld/bin/$(ISA)/ctfmerge CTFCONVERT = /opt/onbld/bin/$(ISA)/ctfconvert @@ -121,8 +123,13 @@ JAVA = $(JAVA_HOME)/bin/java # Consumers must depend on java (or java/adr) -ADRLOC=$(SRC)/java/adr/adr.jar -RADADRGEN=$(JAVA) -classpath $(ADRLOC) org.opensolaris.os.adr.adrgen.RadADRGen +ADRDIR=$(SRC)/java/adr +ADRLOC=$(ADRDIR)/adr.jar +RADADRGEN = $(ENV) \ + RADADR_SCHEMA=$(ADRDIR)/xml/rng/radadr.rng \ + RADADR_XSLDIR=$(ADRDIR)/xml/style \ + RADADR_JARDIR=$(ADRDIR) \ + $(ADRDIR)/radadrgen.sh # Lint LINTFLAGS = -s -errtags=yes -errsecurity=core -errwarn=%all diff -r 2122a04679c0 -r 8a6fba4105d7 usr/src/Makefile.targ --- a/usr/src/Makefile.targ Wed Mar 14 04:47:00 2012 -0700 +++ b/usr/src/Makefile.targ Wed Mar 14 10:45:15 2012 -0400 @@ -91,10 +91,10 @@ $(LINT.c) -mnuvxy -o $(LIBNAME) $(LINTSRCS) > $(LINTOUT) 2>&1 api_%.h api_%_impl.c: $(SRC)/apis/%.xml - $(RADADRGEN) -crm $(ADROPTS) $< + $(RADADRGEN) -c . -rm $(ADROPTS) $< api_%.h api_%_impl.c: %.xml - $(RADADRGEN) -crm $(ADROPTS) $< + $(RADADRGEN) -c . -rm $(ADROPTS) $< .c.o: $(COMPILE.c) $(OUTPUT_OPTION) $< $(CTFCONVERT_HOOK) diff -r 2122a04679c0 -r 8a6fba4105d7 usr/src/cmd/radcli/Makefile --- a/usr/src/cmd/radcli/Makefile Wed Mar 14 04:47:00 2012 -0700 +++ b/usr/src/cmd/radcli/Makefile Wed Mar 14 10:45:15 2012 -0400 @@ -64,9 +64,9 @@ $(ADR_SRCS): $(ADRLOC) api_%.h api_%_impl.c: $(SRC)/apis/%.xml - $(RADADRGEN) -c $< + $(RADADRGEN) -c . $< api_%.h api_%_impl.c: %.xml - $(RADADRGEN) -c $< + $(RADADRGEN) -c . $< include $(SRC)/Makefile.targ diff -r 2122a04679c0 -r 8a6fba4105d7 usr/src/doc/manpage/Makefile --- a/usr/src/doc/manpage/Makefile Wed Mar 14 04:47:00 2012 -0700 +++ b/usr/src/doc/manpage/Makefile Wed Mar 14 10:45:15 2012 -0400 @@ -25,16 +25,23 @@ include ../Makefile.doc +APISDIR = $(SRC)/apis +APIS_CMD = (cd $(APISDIR); $(LS) -1 *.xml 2>/dev/null; $(TRUE)) +#APIS = $(APIS_CMD:sh) +APIS = kstat.xml smf.xml zonesbridge.xml + MANPAGES_1 = radadrgen.1 vp.1 MANPAGES_1m = rad.1m -MANPAGES = $(MANPAGES_1) $(MANPAGES_1m) +MANPAGES_3rad = $(APIS:%.xml=%.3rad) +MANPAGES = $(MANPAGES_1) $(MANPAGES_1m) $(MANPAGES_3rad) CLOBBER_FILES += $(MANPAGES) SRCS = \ - $(MANPAGES_1:%.1=man-%.xml) \ - $(MANPAGES_1m:%.1m=man-%.xml) + $(MANPAGES_1:%=%.xml) \ + $(MANPAGES_1m:%=%.xml) INSTALLED_FILES = \ $(MANPAGES_1:%=$(PROTO_MAN)/man1/%) \ - $(MANPAGES_1m:%=$(PROTO_MAN)/man1m/%) + $(MANPAGES_1m:%=$(PROTO_MAN)/man1m/%) \ + $(MANPAGES_3rad:%=$(PROTO_MAN)/man3rad/%) all: $(MANPAGES) @@ -54,15 +61,18 @@ FIX_MAN = -echo '1,$$s/(lq/*(lq/g\n1,$$s/(rq/*(rq\nw' | ed -s $@ -%.1: man-%.xml +$(PROTO_MAN)/man1/% $(PROTO_MAN)/man1m/% $(PROTO_MAN)/man3rad/%: % + $(INS.file) + +%.1: %.1.xml $(XSLT.man) $(FIX_MAN) -%.1m: man-%.xml +%.1m: %.1m.xml $(XSLT.man) $(FIX_MAN) -$(PROTO_MAN)/man1/% $(PROTO_MAN)/man1m/%: % - $(INS.file) +%.3rad: $(APISDIR)/%.xml + $(RADADRGEN) -N -o man $< > $@ include $(SRC)/Makefile.targ diff -r 2122a04679c0 -r 8a6fba4105d7 usr/src/doc/manpage/man-rad.xml --- a/usr/src/doc/manpage/man-rad.xml Wed Mar 14 04:47:00 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,621 +0,0 @@ - - - - - - - July 7, 2011 - SunOS - 5.11 - - - - rad - 1m - System Administration Commands - - - - rad - the Remote Administration Daemon - - - - - /usr/lib/rad/rad - - - - fmri - - - module - - - module - - - - moduledir - - - moduledir - - - - transpec - - - transpec - - - - timeout - - - - - Description - - rad is a facility that securely exposes programmatic system - administrative and monitoring interfaces to consumers in a - variety of high-level languages. - - - rad can be used in two ways. rad can be run as a service, - in which case it authenticates connections using - getpeerucred - 3C or - pam - 3PAM . When used in - this way, APIs consumed are run as the authenticated user. - This mode of operation is provided with both local - consumers looking to isolate execution of their privileged - operations and remote consumers in mind. rad can also be - run as an unprivileged program, in which case it serves - solely as a bridge between its clients and the - administrative APIs it publishes. When used in this way, - any APIs consumed will be run with the rights held by the - rad process. - - - rad is modular. The APIs published by rad are delivered as - shared objects, as are the protocols it understands and the - transports it can communicate over. Multiple instances of - rad can run simultaneously, each functioning independently - of the others, providing different services to different - consumers, and listening for different types of connections - on different ports or interfaces. rad obtains its - configuration from its command-line options, from - smf - 5 , or from a - combination of the two. - - - - Options - - The following options are available for use on the command - line: - - - - - - - Emit verbose debugging output. - - - - - timeout - - Specify a connection timeout in seconds. The default - value is 180 seconds. - - - - - - moduledir - - - Add moduledir to the list of - directories to scan and load modules from. The - option can be used multiple times - to add multiple module directories. - - - - - - module - - - Add module to the list of - modules to load. module - should be an absolute pathname or a pathname relative - to the current working directory. Modules loaded with - take precedence over modules found - using . The - option can be used multiple times to add multiple - modules. - - - - - transpec - - Instantiate a transport specified by transport - specification transpec. A - transport specification has the following format: - - transport[:option[=value][,option2[=value2]]...] - - - - - - - Behave as an - svc.startd - 1M start method. - This option has the following effects: - - If the option is not specified, rad - will read its configuration from the service identified - by scf_myname - 3SCF. - - rad will use - smf_method - 5 -compatible - exit statuses. - - rad will daemonize, returning success only once it is - ready to handle requests. - - - - - fmri - - Read configuration from the SMF service instance - specified by fmri. When the - option isn't specified, configured - transports are not read from the - service to avoid endpoint conflicts with a running - service. - - Module directories specified on the command line are - searched before module directories configured in SMF, - permitting command line configuration to override SMF - configuration. - - - - - - - - SMF Configuration - - When rad reads its configuration from - smf 5 - , it reads general configuration from a - property group called config of type - application, and reads configuration for - each of an arbitrary number of transports from a series of - properties groups of type xport_XYZ where - XYZ is replaced with the name of the - transport type. Multiple instances of a particular - transport type can be configured by creating multiple - property groups of the corresponding type. The names of - the property groups used to configure transports are not - important. - - - - The config property group contains the - following properties: - - - - - moduledir - - A list of astrings. The directories - to scan and load modules from. - - - - - modules - - A list of astrings. The file names - of specific modules to load. - - - - - pam_service - - An astring. The - pam - 3PAM service - name to use when authenticating. Defaults to - rad. - - - - - debug - - A boolean. If true, rad will emit - verbose debugging output. Defaults to - false. - - - - - timeout - - An integer. The maximum time in - seconds to wait for an individual response from the - client while authenticating. Defaults to - 180. - - - - - - - - Transports - - Support for different transport types is delivered in - module form. Modules for the following transports are - supplied with the system: pipes (pipe), TCP sockets (tcp), - TLS sockets (tls), and Unix-domain sockets (unix). Each - transport type has a unique set of configuration - properties. The options for an instance of a transport - type are configured either by defining properties in an SMF - property group or by supplying sub-options to a - command-line option. - - - - The pipe transport reads from and writes to - a specific file descriptor, as is needed when a process - wishes to communicate with a child rad process using a - pipe. The pipe transport has the following options: - - - - - proto - - An astring. The protocol to use - with this transport instance. Defaults to - rad. - - - - - fd - - An integer. The file descriptor to - read from/write to. - - - - - exit - - A boolean. If true, rad will exit - when communication over the pipe ends. Defaults to - false. - - - - - - - - The tcp transport listens for clear-text - connections on a TCP socket. The tcp transport has the - following options: - - - - - proto - - An astring. The protocol to use - with this transport instance. Defaults to - rad. - - - - - port - - An integer. The port to listen on - for connections. - - - - - localonly - - A boolean. If true, rad will only - listen for connections from the local machine. - Defaults to true. - - - - - - - - The tls transport listens for TLS - connections on a TCP socket. The tcp transport has the - following options: - - - - - proto - - An astring. The protocol to use - with this transport instance. Defaults to - rad. - - - - - port - - An integer. The port to listen on - for connections. - - - - - localonly - - A boolean. If true, rad will only - listen for connections from the local machine. - Defaults to true. - - - - - certificate - - An astring. The location of the - PEM-formatted x509 certificate to use. - - - - - privatekey - - An astring. The location of the - PEM-formatted private key to use. - - - - - generate - - A boolean. If true, - and if the specified certificate - and privatekey do not exist, rad will generate a new - certificate and private key using - openssl - 1openssl . - Defaults to false. - - - - - - - - The unix transport listens for connections - on an AF_UNIX socket. The unix transport has the following - options: - - - - - proto - - An astring. The protocol to use - with this transport instance. Defaults to - rad. - - - - - path - - An astring. The path to listen on. - - - - - peercred - - A boolean. If true, rad will - attempt to automatically authenticate connections using - - getpeerucred - 3C . Defaults to - true. - - - - - - - - Files - - - - /etc/rad/cert.pem - - The location where the remote rad instance - (svc:/system/rad:remote) stores its - certificate. This file is readable by all users. - - - - /etc/rad/key.pem - - The location where the remote rad instance - (svc:/system/rad:remote) stores its private - key. - - - - - /system/volatile/rad/radsocket - - The AF_UNIX socket where the local rad instance - (svc:/system/rad:local) accepts connections - that are implicitly authenticated with - getpeerucred - 3C . - - - - /system/volatile/rad/radsocket-unauth - - The AF_UNIX socket where the local rad instance - (svc:/system/rad:local) accepts connections - that must explicitly authenticate using - pam - 3PAM . - - - - - - - Attributes - - See - attributes - 5 for descriptions - of the following attributes: - - - - - - ATTRIBUTE TYPE - ATTRIBUTE VALUE - - - - - Availability - system/management/rad - - - Interface Stability - Private - - - - - - - See Also - - - attributes - 5 - , - - getpeerucred - 3C - , - - openssl - 1openssl - . - - pam - 3PAM - , - - pipe - 2 - , - - rad - 1M - , - - scf_myname - 3SCF - , - - smf - 5 - , - - smf_method - 5 - , - - svc.startd - 1M - , - - vp - 1 - - - - - Notes - - Two instances of rad are delivered by the system. - svc:/system/rad:local listens to AF_UNIX - connections at the paths /system/volatile/rad/radsocket and - /system/volatile/rad/radsocket-unauth, and is enabled by - default. The former AF_UNIX socket will automatically - authenticate the connecting process using - getpeerucred - 3C , while the latter - requires the connecting process to explicitly - authenticate. svc:/system/rad:remote listens to - TLS connections on the port 12302, requires all clients - to explicitly authenticate, and is disabled by default. - - - Other system components, including some desktop - administrative user interfaces, rely on the local - instance of rad (svc:/system/rad:local). - - - diff -r 2122a04679c0 -r 8a6fba4105d7 usr/src/doc/manpage/man-radadrgen.xml --- a/usr/src/doc/manpage/man-radadrgen.xml Wed Mar 14 04:47:00 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,155 +0,0 @@ - - - - - - - April 12, 2010 - SunOS - 5.11 - - - - radadrgen - 1 - User Commands - - - - radadrgen - ADR code generator - - - - - /usr/bin/radadrgen - - - - - - - - - dir - - - - baseline.xml - - spec.xml - - - - Description - - radadrgen is the ADR - IDL processing tool. Its primary - purpose is to generate API-specific - language bindings for the rad server and - the various rad client environments. - It can also audit changes to interfaces for consistency - with their versions. - - - - - Options - - The following options are available for use on the command - line: - - - - - - - Generate C definitions for the types and APIs defined in - the input file. - - - - - - - Generate C server-side definitions that reference entry - points using the prescribed entry-point naming scheme. - - - - - - - Generate C stubs for entry points referenced by the - defintions created by the option. - - - - - dir - - Generate Java interfaces for the types and APIs defined in - the input file. The Java source tree will be created under - dir. - - - - - - - Generate concrete implementation classes for all interfaces - generated by the option. - - - - - - baseline.xml - - Compare the interfaces defined by baseline.xml - and spec.xml and - verify that the version of the modified interface is consistent - with the differences found. An error message is displayed if - the versions are inconsistent. - - - - - - - - Operands - - The following operand must be specified on the command line: - - - - - spec.xml - - The path to the ADR specification for which type and API - definitions must be generated. - - - - - - - diff -r 2122a04679c0 -r 8a6fba4105d7 usr/src/doc/manpage/man-vp.xml --- a/usr/src/doc/manpage/man-vp.xml Wed Mar 14 04:47:00 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,155 +0,0 @@ - - - - - - - March 24, 2010 - SunOS - 5.11 - - - - vp - 1 - User Commands - - - - vp - starts a Visual Panels UI - - - - - /usr/bin/vp - - host - - - port - - - user - - - role - - - - address - - - - - /usr/bin/vp - - - - - /usr/bin/vp - - - - - Description - - vp starts the Visual Panels UI specified by - address. - - - - Options - - The following options are supported: - - - host - - Connect to host host. - - - - - port - - Connect to port port. - - - - - user - - Log in as user user. - - - - - role - - Log in as role role. - - - - - - - Launch the specified panel using a new JVM. Normally an - existing JVM is used, if available. - - - - - - - Print the version number and exit. - - - - - - - Print the help message and exit. - - - - - - - Operands - - The following operand is supported: - - - address - - The address of the management panel to open. - - - - - - - See Also - - - rad - 1M - - - - diff -r 2122a04679c0 -r 8a6fba4105d7 usr/src/doc/manpage/rad.1m.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usr/src/doc/manpage/rad.1m.xml Wed Mar 14 10:45:15 2012 -0400 @@ -0,0 +1,617 @@ + + + + + + + SunOS + 5.11 + + + + rad + 1m + System Administration Commands + + + + rad + the Remote Administration Daemon + + + + + /usr/lib/rad/rad + + + + fmri + + + module + + + module + + + + moduledir + + + moduledir + + + + transpec + + + transpec + + + + timeout + + + + + Description + + rad is a facility that securely exposes programmatic system + administrative and monitoring interfaces to consumers in a + variety of high-level languages. + + + rad can be used in two ways. rad can be run as a service, + in which case it authenticates connections using + getpeerucred + 3C or + pam + 3PAM . When used in + this way, APIs consumed are run as the authenticated + user. This mode of operation is provided with both local consumers + looking to isolate execution of their privileged operations and remote + consumers in mind. rad can also be run as an unprivileged program, in + which case it serves solely as a bridge between its clients and the + administrative APIs it publishes. When used in this + way, any APIs consumed will be run with the rights held + by the rad process. + + + rad is modular. The APIs published by rad are + delivered as shared objects, as are the protocols it understands and the + transports it can communicate over. Multiple instances of rad can run + simultaneously, each functioning independently of the others, providing + different services to different consumers, and listening for different + types of connections on different ports or interfaces. rad obtains its + configuration from its command-line options, from + smf 5 + , or from a combination of the two. + + + + Options + + The following options are available for use on the command + line: + + + + + + + Emit verbose debugging output. + + + + + timeout + + Specify a connection timeout in seconds. The default + value is 180 seconds. + + + + + + moduledir + + + Add moduledir to the list of + directories to scan and load modules from. The + option can be used multiple times + to add multiple module directories. + + + + + + module + + + Add module to the list of + modules to load. module + should be an absolute pathname or a pathname relative + to the current working directory. Modules loaded with + take precedence over modules found + using . The + option can be used multiple times to add multiple + modules. + + + + + transpec + + Instantiate a transport specified by transport + specification transpec. A + transport specification has the following format: + + transport[:option[=value][,option2[=value2]]...] + + + + + + + Behave as an + svc.startd + 1M start method. + This option has the following effects: + + If the option is not specified, rad + will read its configuration from the service identified + by scf_myname + 3SCF. + + rad will use + smf_method + 5 -compatible + exit statuses. + + rad will daemonize, returning success only once it is + ready to handle requests. + + + + + fmri + + Read configuration from the SMF service instance + specified by fmri. When the + option isn't specified, configured + transports are not read from the + service to avoid endpoint conflicts with a running + service. + + Module directories specified on the command line are + searched before module directories configured in SMF, + permitting command line configuration to override SMF + configuration. + + + + + + + + SMF Configuration + + When rad reads its configuration from + smf 5 + , it reads general configuration from a + property group called config of type + application, and reads configuration for + each of an arbitrary number of transports from a series of + properties groups of type xport_XYZ where + XYZ is replaced with the name of the + transport type. Multiple instances of a particular + transport type can be configured by creating multiple + property groups of the corresponding type. The names of + the property groups used to configure transports are not + important. + + + + The config property group contains the + following properties: + + + + + moduledir + + A list of astrings. The directories + to scan and load modules from. + + + + + modules + + A list of astrings. The file names + of specific modules to load. + + + + + pam_service + + An astring. The + pam + 3PAM service + name to use when authenticating. Defaults to + rad. + + + + + debug + + A boolean. If true, rad will emit + verbose debugging output. Defaults to + false. + + + + + timeout + + An integer. The maximum time in + seconds to wait for an individual response from the + client while authenticating. Defaults to + 180. + + + + + + + + Transports + + Support for different transport types is delivered in + module form. Modules for the following transports are + supplied with the system: pipes (pipe), TCP sockets (tcp), + TLS sockets (tls), and Unix-domain sockets (unix). Each + transport type has a unique set of configuration + properties. The options for an instance of a transport + type are configured either by defining properties in an SMF + property group or by supplying sub-options to a + command-line option. + + + + The pipe transport reads from and writes to + a specific file descriptor, as is needed when a process + wishes to communicate with a child rad process using a + pipe. The pipe transport has the following options: + + + + + proto + + An astring. The protocol to use + with this transport instance. Defaults to + rad. + + + + + fd + + An integer. The file descriptor to + read from/write to. + + + + + exit + + A boolean. If true, rad will exit + when communication over the pipe ends. Defaults to + false. + + + + + + + + The tcp transport listens for clear-text + connections on a TCP socket. The tcp transport has the + following options: + + + + + proto + + An astring. The protocol to use + with this transport instance. Defaults to + rad. + + + + + port + + An integer. The port to listen on + for connections. + + + + + localonly + + A boolean. If true, rad will only + listen for connections from the local machine. + Defaults to true. + + + + + + + + The tls transport listens for TLS + connections on a TCP socket. The tcp transport has the + following options: + + + + + proto + + An astring. The protocol to use + with this transport instance. Defaults to + rad. + + + + + port + + An integer. The port to listen on + for connections. + + + + + localonly + + A boolean. If true, rad will only + listen for connections from the local machine. + Defaults to true. + + + + + certificate + + An astring. The location of the + PEM-formatted x509 certificate to use. + + + + + privatekey + + An astring. The location of the + PEM-formatted private key to use. + + + + + generate + + A boolean. If true, + and if the specified certificate + and privatekey do not exist, rad will generate a new + certificate and private key using + openssl + 1openssl . + Defaults to false. + + + + + + + + The unix transport listens for connections + on an AF_UNIX socket. The unix transport has the following + options: + + + + + proto + + An astring. The protocol to use + with this transport instance. Defaults to + rad. + + + + + path + + An astring. The path to listen on. + + + + + peercred + + A boolean. If true, rad will + attempt to automatically authenticate connections using + + getpeerucred + 3C . Defaults to + true. + + + + + + + + Files + + + + /etc/rad/cert.pem + + The location where the remote rad instance + (svc:/system/rad:remote) stores its + certificate. This file is readable by all users. + + + + /etc/rad/key.pem + + The location where the remote rad instance + (svc:/system/rad:remote) stores its private + key. + + + + + /system/volatile/rad/radsocket + + The AF_UNIX socket where the local rad instance + (svc:/system/rad:local) accepts connections + that are implicitly authenticated with + getpeerucred + 3C . + + + + /system/volatile/rad/radsocket-unauth + + The AF_UNIX socket where the local rad instance + (svc:/system/rad:local) accepts connections + that must explicitly authenticate using + pam + 3PAM . + + + + + + + Attributes + + See + attributes + 5 for descriptions + of the following attributes: + + + + + + ATTRIBUTE TYPE + ATTRIBUTE VALUE + + + + + Availability + system/management/rad + + + Interface Stability + Private + + + + + + + See Also + + + attributes + 5 + , + + getpeerucred + 3C + , + + openssl + 1openssl + . + + pam + 3PAM + , + + pipe + 2 + , + + rad + 1M + , + + scf_myname + 3SCF + , + + smf + 5 + , + + smf_method + 5 + , + + svc.startd + 1M + , + + vp + 1 + + + + + Notes + + Two instances of rad are delivered by the system. + svc:/system/rad:local listens to AF_UNIX + connections at the paths /system/volatile/rad/radsocket and + /system/volatile/rad/radsocket-unauth, and is enabled by + default. The former AF_UNIX socket will automatically + authenticate the connecting process using + getpeerucred + 3C , while the latter + requires the connecting process to explicitly + authenticate. svc:/system/rad:remote listens to + TLS connections on the port 12302, requires all clients + to explicitly authenticate, and is disabled by default. + + + Other system components, including some desktop + administrative user interfaces, rely on the local + instance of rad (svc:/system/rad:local). + + + diff -r 2122a04679c0 -r 8a6fba4105d7 usr/src/doc/manpage/radadrgen.1.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usr/src/doc/manpage/radadrgen.1.xml Wed Mar 14 10:45:15 2012 -0400 @@ -0,0 +1,362 @@ + + + + + + + SunOS + 5.11 + + + + radadrgen + 1 + User Commands + + + + radadrgen + API code generator + + + + + /usr/bin/radadrgen + + + + + spec.xml + + + + + /usr/bin/radadrgen + + + + + + + + dir + + + + + + + + + + + + spec.xml + + + + + /usr/bin/radadrgen + + + + + + + + dir + + + + + + spec.xml + + + + + /usr/bin/radadrgen + + + + + + + + docbook + docbook-man + man + rmdoc + + + spec.xml + + + + + /usr/bin/radadrgen + + + + + baseline.xml + + + spec.xml + + + + + + + Description + + radadrgen is the ADR + IDL processing tool. Its primary + purpose is to generate API-specific + language bindings for the rad server and + the various rad client environments. + It can also generate documentation, and audit changes + to interfaces for consistency with their versions. + + + + All invocations validate the given spec.xml + against the ADR schema. + + + + + Options + + + The following options are available for use on the command line: + + + + + <variablelist> + <title>Common Options + + + + + + + Don't limit what types can be optional. This restriction is in + place to facilitate mapping to languages where certain types + aren't naturally nullable. This option relaxes this restriction + for uses where it is both permissible and advantageous for all + types to be optional. + + + + + + + + + <variablelist> + <title>C Definition Options + + + + dir + + + + Generate C definitions for the types and APIs + defined in the input file. Files will be created under + dir. + + + + + + + + + + + Generate C server-side definitions that reference entry + points using the prescribed entry-point naming scheme. + + + + + + + + + + + Don't generate separate definitions for inherited + APIs. By default, new definitions are + generated for inherited APIs, replicating the + definitions in the inherited API. + + + + + + + + + + + Generate C stubs for entry points referenced by the + defintions created by the option. + + + + + + + + + <variablelist> + <title>Java Definition Options + + + + dir + + + + Generate Java interfaces for the types and APIs + defined in the input file. The Java source tree will be created + under + dir. + + + + + + + + + + + Generate concrete implementation classes for all interfaces + generated by the option. + + + + + + + + + <variablelist> + <title>Documentation Generation Options + + + + format + + + + Generate documentation, in the given format, for the interface + definition in spec.xml. Documentation + can be improved by decorating the various parts of the interface + definition with <summary> and <doc> elements. + + + Valid formats: + + + + docbook + + + standard docbook format + + + + + docbook-man + + + man page content in docbook format, a precursor to man + format, below + + + + + man + + + a man page, in [nt]roff format + + + + + rmdoc + + + spec.xml, with the + <summary> and <doc> elements removed + + + + + + + + + + + + <variablelist> + <title>Interface Comparison Options + + + + baseline.xml + + + + Compare the interfaces defined by + baseline.xml and spec.xml + and verify that the version of the modified + interface is consistent with the differences found. An error + message is displayed if the versions are inconsistent. + + + + + + + + Operands + + The following operand must be specified on the command line: + + + + + spec.xml + + The path to the API specification for which type + and API definitions must be generated. + + + + + + + diff -r 2122a04679c0 -r 8a6fba4105d7 usr/src/doc/manpage/vp.1.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usr/src/doc/manpage/vp.1.xml Wed Mar 14 10:45:15 2012 -0400 @@ -0,0 +1,154 @@ + + + + + + + SunOS + 5.11 + + + + vp + 1 + User Commands + + + + vp + starts a Visual Panels UI + + + + + /usr/bin/vp + + host + + + port + + + user + + + role + + + + address + + + + + /usr/bin/vp + + + + + /usr/bin/vp + + + + + Description + + vp starts the Visual Panels UI specified by + address. + + + + Options + + The following options are supported: + + + host + + Connect to host host. + + + + + port + + Connect to port port. + + + + + user + + Log in as user user. + + + + + role + + Log in as role role. + + + + + + + Launch the specified panel using a new JVM. Normally an + existing JVM is used, if available. + + + + + + + Print the version number and exit. + + + + + + + Print the help message and exit. + + + + + + + Operands + + The following operand is supported: + + + address + + The address of the management panel to open. + + + + + + + See Also + + + rad + 1M + + + + diff -r 2122a04679c0 -r 8a6fba4105d7 usr/src/doc/rad-dev/Makefile --- a/usr/src/doc/rad-dev/Makefile Wed Mar 14 04:47:00 2012 -0700 +++ b/usr/src/doc/rad-dev/Makefile Wed Mar 14 10:45:15 2012 -0400 @@ -48,7 +48,7 @@ all: html examples: - $(RADADRGEN) -c example.xml + $(RADADRGEN) -c . example.xml docbook: examples $(PROC) diff -r 2122a04679c0 -r 8a6fba4105d7 usr/src/doc/rad-dev/c-libadr-radadrgen.xml --- a/usr/src/doc/rad-dev/c-libadr-radadrgen.xml Wed Mar 14 04:47:00 2012 -0700 +++ b/usr/src/doc/rad-dev/c-libadr-radadrgen.xml Wed Mar 14 10:45:15 2012 -0400 @@ -35,7 +35,7 @@ Invoking <command>radadrgen</command> -$ radadrgen -c example.xml +$ radadrgen -c . example.xml diff -r 2122a04679c0 -r 8a6fba4105d7 usr/src/doc/rad-dev/c-manpage.xml --- a/usr/src/doc/rad-dev/c-manpage.xml Wed Mar 14 04:47:00 2012 -0700 +++ b/usr/src/doc/rad-dev/c-manpage.xml Wed Mar 14 10:45:15 2012 -0400 @@ -30,7 +30,7 @@ <command>man</command> pages - + - + diff -r 2122a04679c0 -r 8a6fba4105d7 usr/src/java/adr/build.xml --- a/usr/src/java/adr/build.xml Wed Mar 14 04:47:00 2012 -0700 +++ b/usr/src/java/adr/build.xml Wed Mar 14 10:45:15 2012 -0400 @@ -23,23 +23,47 @@ --> - + + + + + + - - + - + + + - + + + + + - + - - + + + + diff -r 2122a04679c0 -r 8a6fba4105d7 usr/src/java/adr/org/opensolaris/os/adr/APIDiff.java --- a/usr/src/java/adr/org/opensolaris/os/adr/APIDiff.java Wed Mar 14 04:47:00 2012 -0700 +++ b/usr/src/java/adr/org/opensolaris/os/adr/APIDiff.java Wed Mar 14 10:45:15 2012 -0400 @@ -20,13 +20,15 @@ */ /* - * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. */ package org.opensolaris.os.adr; -import java.util.Map; -import java.util.EnumMap; +import java.io.File; +import java.util.*; +import java.util.Map.Entry; +import org.opensolaris.os.adr.adrgen.*; public class APIDiff { public static int diff(Map oldApis, Map newApis) { @@ -116,4 +118,29 @@ } return err; } + + /** + * Performs intrinsic validation of the given spec files, then diffs the two + * interfaces. Note: this method does NOT validate against a schema. + * + * Usage: java ... + */ + public static void main(String[] args) { + CLI cli = new CLI(APIDiff.class); + if (args.length != 2) { + cli.die(2, "exactly two spec files must be specified"); + } + ADRGen[] adr = new ADRGen[2]; + for (int i = 0; i < adr.length; i++) { + File file = new File(args[i]); + try { + adr[i] = new ADRGen(file, false); + } catch (ParseException e) { + cli.die(1, "error parsing file %s: %s", file, + e.getLocalizedMessage()); + } + } + APIDiff.diff(adr[0].getInterface().getAPIs(), + adr[1].getInterface().getAPIs()); + } } diff -r 2122a04679c0 -r 8a6fba4105d7 usr/src/java/adr/org/opensolaris/os/adr/CLI.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usr/src/java/adr/org/opensolaris/os/adr/CLI.java Wed Mar 14 10:45:15 2012 -0400 @@ -0,0 +1,144 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL 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, Oracle and/or its affiliates. All rights reserved. + */ + +package org.opensolaris.os.adr; + +import java.util.*; + +public class CLI { + // + // Inner classes + // + + public static class Option { + private char letter_; + private String arg_; + + public Option(char letter, String arg) { + letter_ = letter; + arg_ = arg; + } + + public char getLetter() { + return letter_; + } + + public String getArg() { + return arg_; + } + } + + // + // Instance data + // + + private Class mainClass; + + // + // Constructors + // + + public CLI(Class mainClass) { + this.mainClass = mainClass; + } + + // + // CLI methods + // + + public void die(int exit, String format, Object... args) { + if (format != null) { + System.err.printf("%s: ", getProg()); + System.err.printf(format, args); + System.err.println(); + } + System.exit(exit); + } + + public int getOptions(String[] args, String argspec, + Map opts) { + + Map optspecs = new HashMap(); + + /* Parse argspec */ + int length = argspec.length(); + for (int i = 0; i < length; i++) { + char l = argspec.charAt(i); + boolean hasargs = i + 1 < length && argspec.charAt(i + 1) == ':'; + if (hasargs) + i++; + optspecs.put(l, hasargs); + } + + /* Parse args */ + boolean inopt = false; + char pending = '\0'; + int i; + for (i = 0; i < args.length; i++) { + if (inopt) { + opts.put(pending, new Option(pending, args[i])); + inopt = false; + continue; + } + + if (args[i].length() == 0 || args[i].charAt(0) != '-') + break; + + for (int j = 1; j < args[i].length(); j++) { + char l = args[i].charAt(j); + if (!optspecs.containsKey(l)) { + die(2, "invalid option: \"%c\"", l); + } + + if (!optspecs.get(l)) { + opts.put(l, new Option(l, null)); + continue; + } + + if (j + 1 < args[i].length()) { + opts.put(l, new Option(l, args[i].substring(j + 1))); + break; + } + + inopt = true; + pending = l; + } + } + + if (inopt) { + die(2, "option \"%c\" requires an argument", pending); + } + + return i; + } + + private String getProg() { + String prog = System.getProperty("argv0"); + if (prog == null) { + prog = "java " + mainClass.getName(); + } + return prog; + } +} diff -r 2122a04679c0 -r 8a6fba4105d7 usr/src/java/adr/org/opensolaris/os/adr/Interface.java --- a/usr/src/java/adr/org/opensolaris/os/adr/Interface.java Wed Mar 14 04:47:00 2012 -0700 +++ b/usr/src/java/adr/org/opensolaris/os/adr/Interface.java Wed Mar 14 10:45:15 2012 -0400 @@ -20,15 +20,12 @@ */ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. */ package org.opensolaris.os.adr; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; +import java.util.*; /** * Represents an ADR interface, which consists of APIs and the types they @@ -212,12 +209,12 @@ /** - * Returns an unmodifiable collection of APIs defined by the interface. + * Returns an unmodifiable map of APIs defined by the interface. * - * @return an unmodifiable collection of APIs + * @return an unmodifiable map of APIs */ - public Collection getAPIs() { - return Collections.unmodifiableCollection(apis_.values()); + public Map getAPIs() { + return Collections.unmodifiableMap(apis_); } /** diff -r 2122a04679c0 -r 8a6fba4105d7 usr/src/java/adr/org/opensolaris/os/adr/adrgen/ADR.rng --- a/usr/src/java/adr/org/opensolaris/os/adr/adrgen/ADR.rng Wed Mar 14 04:47:00 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,386 +0,0 @@ - - - - - - - - - - - - - - boolean - string - integer - long - time - name - uinteger - ulong - opaque - password - float - double - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - boolean - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ro - rw - wo - - - - - - - - - - - - committed - uncommitted - private - - - - - - - - - - - - ro - rw - wo - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - committed - uncommitted - private - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 2122a04679c0 -r 8a6fba4105d7 usr/src/java/adr/org/opensolaris/os/adr/adrgen/ADRGen.java --- a/usr/src/java/adr/org/opensolaris/os/adr/adrgen/ADRGen.java Wed Mar 14 04:47:00 2012 -0700 +++ b/usr/src/java/adr/org/opensolaris/os/adr/adrgen/ADRGen.java Wed Mar 14 10:45:15 2012 -0400 @@ -27,8 +27,9 @@ import java.io.*; import java.util.*; -import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.*; import org.opensolaris.os.adr.*; +import org.opensolaris.os.adr.CLI.Option; import org.opensolaris.os.adr.Type.*; import org.w3c.dom.*; import org.xml.sax.*; @@ -114,6 +115,10 @@ throw new ParseException("UNKNOWN TYPE: " + type); } + public Interface getInterface() { + return iface_; + } + private boolean validOptional(Type t) { if (checkNullable_) { if (t.getSource() == Type.Source.ENUM) @@ -239,7 +244,7 @@ T result = parseRef(e, m); if (result == null) throw new ParseException("include node requires non-empty typeref"); - return result; + return result; } private void resolveForward(String name, Type newtype) @@ -423,7 +428,7 @@ arms.add(a); values.add(a); } - } else { + } else { throw new ParseException( "Union discriminants must be enumerations or booleans"); } @@ -642,7 +647,7 @@ return null; } - public ADRGen(DocumentBuilder builder, File file, boolean checkNullable) + public ADRGen(File file, boolean checkNullable) throws ParseException { checkNullable_ = checkNullable; @@ -655,12 +660,52 @@ * Parse file. */ try { + DocumentBuilderFactory factory = + DocumentBuilderFactory.newInstance(); + factory.setNamespaceAware(true); + + DocumentBuilder builder = factory.newDocumentBuilder(); + + /* + * Contrary to the javadoc, the default error handler just drives on + */ + builder.setErrorHandler( + new ErrorHandler() { + @Override + public void warning(SAXParseException exception) + throws SAXException { + throw exception; + } + + @Override + public void error(SAXParseException exception) + throws SAXException { + throw exception; + } + + @Override + public void fatalError(SAXParseException exception) + throws SAXException { + throw exception; + } + }); + doc_ = builder.parse(file); + + // Thrown by newDocumentBuilder + } catch (ParserConfigurationException ex) { + throw new ParseException(ex.getMessage()); + + // Thrown by parse } catch (SAXParseException ex) { - throw new ParseException(String.format("line %d: %s", - ex.getLineNumber(), ex.getMessage())); + throw new ParseException(String.format("line %d: %s", + ex.getLineNumber(), ex.getMessage())); + + // Thrown by parse } catch (SAXException ex) { throw new ParseException(ex.getMessage()); + + // Thrown by parse } catch (IOException ex) { throw new ParseException(file + ": read error"); } @@ -690,10 +735,39 @@ } if (!forwardTypes_.isEmpty()) { - System.err.println("Unresolved type references:"); - for (String t : forwardTypes_.keySet()) - System.err.println("\t" + t); - throw new ParseException("Unresolved type references"); + StringBuilder builder = new StringBuilder(); + for (String t : forwardTypes_.keySet()) { + if (builder.length() != 0) { + builder.append(", "); + } + builder.append(t); + } + builder.insert(0, "unresolved type references:"); + throw new ParseException(builder.toString()); + } + } + + /** + * Performs intrinsic validation of the given spec file. Note: this method + * does NOT validate against a schema. + * + * Usage: java ... [-N] + */ + public static void main(String[] args) { + CLI cli = new CLI(ADRGen.class); + Map opts = new HashMap(); + int operands = cli.getOptions(args, "N", opts); + if (operands == args.length) { + cli.die(2, "spec file not specified"); + } + + File file = new File(args[operands]); + boolean check_nullable = opts.get('N') == null; + try { + new ADRGen(file, check_nullable); + } catch (ParseException e) { + cli.die(1, "error parsing file %s: %s", file, + e.getLocalizedMessage()); } } } diff -r 2122a04679c0 -r 8a6fba4105d7 usr/src/java/adr/org/opensolaris/os/adr/adrgen/ADRdoc.rng --- a/usr/src/java/adr/org/opensolaris/os/adr/adrgen/ADRdoc.rng Wed Mar 14 04:47:00 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,206 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - unordered - ordered - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 2122a04679c0 -r 8a6fba4105d7 usr/src/java/adr/org/opensolaris/os/adr/adrgen/ADRdoc.xsd --- a/usr/src/java/adr/org/opensolaris/os/adr/adrgen/ADRdoc.xsd Wed Mar 14 04:47:00 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,172 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 2122a04679c0 -r 8a6fba4105d7 usr/src/java/adr/org/opensolaris/os/adr/adrgen/ADRdocbook.xsl --- a/usr/src/java/adr/org/opensolaris/os/adr/adrgen/ADRdocbook.xsl Wed Mar 14 04:47:00 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,771 +0,0 @@ - - - - - - - - - - Interface Documentation - Enumerated Types - Structure Types - Union Types - APIs - interface - enum - fallback - struct - union - case - default - api - Properties - Methods - Events - Version - - from included - property - Type: - Read - Write - Read-Write - R/O - W/O - R/W - Error: - method - Arguments: - Result: - event - void - optional - - - - -
- -
-
- - - - -
- - <xsl:value-of select="@name"/><xsl:value-of select="$lang.title"/> - - - - - - - - - - - -
- <xsl:value-of select="$lang.enumTitle"/> - -
-
- - - -
- <xsl:value-of select="$lang.structTitle"/> - -
-
- - - -
- <xsl:value-of select="$lang.unionTitle"/> - -
-
- - - -
- <xsl:value-of select="$lang.apiTitle"/> - -
-
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ( - - - - ) - - - - - - - - - - - - - - - - - - - ( - - - - ) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ( - - ) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - : - - - - - - - - - - : - - - - - - - -
- - <xsl:attribute name="id"> - <xsl:value-of select="concat('api', @name)"/> - </xsl:attribute> - <xsl:value-of select="$lang.apiHead"/><xsl:value-of select="@name"/> - - - - - - - - - - - - - - - - -
- - <xsl:value-of select="@name"/> - <xsl:value-of select="$lang.propHead"/> - - -
-
- - - -
- - <xsl:value-of select="@name"/> - <xsl:value-of select="$lang.propHead"/> - <xsl:text> (</xsl:text> - <xsl:value-of select="$lang.incApiHead"/> - <link> - <xsl:attribute name="linkend"> - <xsl:value-of - select="concat('api', current()/adr:include/@typeref)"/> - </xsl:attribute> - <xsl:value-of select="$lang.apiHead"/> - <xsl:value-of select="current()/adr:include/@typeref"/> - </link> - <xsl:text>)</xsl:text> - - -
-
- - - -
- - <xsl:value-of select="@name"/> - <xsl:value-of select="$lang.methHead"/> - - -
-
- - - -
- - <xsl:value-of select="@name"/> - <xsl:value-of select="$lang.methHead"/> - <xsl:text> (</xsl:text> - <xsl:value-of select="$lang.incApiHead"/> - <link> - <xsl:attribute name="linkend"> - <xsl:value-of - select="concat('api', current()/adr:include/@typeref)"/> - </xsl:attribute> - <xsl:value-of select="$lang.apiHead"/> - <xsl:value-of select="current()/adr:include/@typeref"/> - </link> - <xsl:text>)</xsl:text> - - -
-
- - - -
- - <xsl:value-of select="@name"/> - <xsl:value-of select="$lang.evHead"/> - - -
-
- - - -
- - <xsl:value-of select="@name"/> - <xsl:value-of select="$lang.evHead"/> - <xsl:text> (</xsl:text> - <xsl:value-of select="$lang.incApiHead"/> - <link> - <xsl:attribute name="linkend"> - <xsl:value-of - select="concat('api', current()/adr:include/@typeref)"/> - </xsl:attribute> - <xsl:value-of select="$lang.apiHead"/> - <xsl:value-of select="current()/adr:include/@typeref"/> - </link> - <xsl:text>)</xsl:text> - - -
-
- -
-
- - - - - - - - ( - - . - - ) - , - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ( - - - - - - , - - ) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [] - - - - - - - - - - - - [] - - - - - - - - - - - - ( - - ) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <xsl:apply-templates/> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff -r 2122a04679c0 -r 8a6fba4105d7 usr/src/java/adr/org/opensolaris/os/adr/adrgen/ADRrmdoc.xsl --- a/usr/src/java/adr/org/opensolaris/os/adr/adrgen/ADRrmdoc.xsl Wed Mar 14 04:47:00 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - diff -r 2122a04679c0 -r 8a6fba4105d7 usr/src/java/adr/org/opensolaris/os/adr/adrgen/ADRtext.xsl --- a/usr/src/java/adr/org/opensolaris/os/adr/adrgen/ADRtext.xsl Wed Mar 14 04:47:00 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,850 +0,0 @@ - - - - - - - - - - INTERFACE DOCUMENTATION - Enumerated Types - Structure Types - Union Types - APIs - Interface - enum - fallback - struct - union - case - default - Api - Properties - Methods - Events - Version - - From Included - Property: - Type: - Read - Write - Read-Write - Read-Only - Write-Only - Read-Write - Error: - Method: - Arguments: - Result: - Event: - void - Optional - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ( - - ) - - - - - - - - - - - - - - - - - - - - - ( - - ) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ( - - ) - - - - - - - - - - - - - - - - - - : - - - - - - - - - - : - - - - - - - - - - - - - - - ( - - - ) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ( - - - - ) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ( - - - - ) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ( - - - - ) - - - - - - - - - - - - - ( - - . - - ) - , - - - - - - - - - - - ( - - , - - - ) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ( - - - , - - ) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ( - - - ) - - - - - - - - - - - - - - - ( - - ) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [] - - - - - [] - - - - - - - - - - - , - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ( - - ) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - . - - - - * - - - - - - - - - - - - - - - - - - diff -r 2122a04679c0 -r 8a6fba4105d7 usr/src/java/adr/org/opensolaris/os/adr/adrgen/CGenerator.java --- a/usr/src/java/adr/org/opensolaris/os/adr/adrgen/CGenerator.java Wed Mar 14 04:47:00 2012 -0700 +++ b/usr/src/java/adr/org/opensolaris/os/adr/adrgen/CGenerator.java Wed Mar 14 10:45:15 2012 -0400 @@ -20,16 +20,16 @@ */ /* - * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. */ package org.opensolaris.os.adr.adrgen; +import java.io.*; +import java.util.*; import org.opensolaris.os.adr.*; -import java.io.FileNotFoundException; -import java.io.PrintStream; -import java.util.LinkedList; -import java.util.List; +import org.opensolaris.os.adr.CLI.Option; +import org.opensolaris.os.adr.Type.*; public class CGenerator { @@ -193,13 +193,14 @@ impl.println(); } - static void generate(ADRGen p, boolean server, boolean stubs, + static void generate(ADRGen p, String outDir, boolean server, boolean stubs, boolean common) throws FileNotFoundException { Interface iface = p.iface_; String header_name = "api_" + p.basename_ + ".h"; - PrintStream o_header = new PrintStream(header_name); - PrintStream o_impl = new PrintStream("api_" + p.basename_ + "_impl.c"); + PrintStream o_header = new PrintStream(new File(outDir, header_name)); + PrintStream o_impl = new PrintStream( + new File(outDir, "api_" + p.basename_ + "_impl.c")); for (Type.BuiltinType t : Type.BUILTINS.values()) setTargetName(t, t.getType().toString().toLowerCase()); @@ -273,7 +274,7 @@ /* XXX: need to require api/feature names be "tame". */ /* XXX: Should keep readers/writers/invokers sorted */ - for (API api : iface.getAPIs()) { + for (API api : iface.getAPIs().values()) { List myinvokers = new LinkedList(); List myreaders = new LinkedList(); List mywriters = new LinkedList(); @@ -511,8 +512,8 @@ if (!stubs) return; - PrintStream o_stubs = - new PrintStream("api_" + p.basename_ + "_stubs.c"); + PrintStream o_stubs = new PrintStream( + new File(outDir, "api_" + p.basename_ + "_stubs.c")); o_stubs.format("#include \n"); o_stubs.format("#include \n\n"); o_stubs.format("#include \n\n"); @@ -560,4 +561,42 @@ o_stubs.format("}\n\n"); } } + + /** + * Performs intrinsic validation of the given spec file, then generates C + * definitions. Note: this method does NOT validate against a schema. + * + * Usage: java ... -d [-N] [-r [-m] [-s]] + */ + public static void main(String[] args) { + CLI cli = new CLI(CGenerator.class); + Map opts = new HashMap(); + int operands = cli.getOptions(args, "d:Nrms", opts); + if (operands == args.length) { + cli.die(2, "spec file not specified"); + } + + File file = new File(args[operands]); + CLI.Option d = opts.get('d'); + if (d == null) { + cli.die(2, "directory not specified"); + } + + String outDir = d.getArg(); + boolean check_nullable = opts.get('N') == null; + boolean generate_server = opts.get('r') != null; + boolean generate_common = opts.get('m') != null; + boolean generate_cstubs = opts.get('s') != null; + try { + ADRGen adr = new ADRGen(file, check_nullable); + CGenerator.generate(adr, outDir, generate_server, generate_cstubs, + generate_common); + } catch (ParseException e) { + cli.die(1, "error parsing file %s: %s", file, + e.getLocalizedMessage()); + } catch (FileNotFoundException e) { + cli.die(1, "error parsing file %s: %s", file, + e.getLocalizedMessage()); + } + } } diff -r 2122a04679c0 -r 8a6fba4105d7 usr/src/java/adr/org/opensolaris/os/adr/adrgen/DocGenerator.java --- a/usr/src/java/adr/org/opensolaris/os/adr/adrgen/DocGenerator.java Wed Mar 14 04:47:00 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -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 (c) 2011, Oracle and/or its affiliates. All rights reserved. - */ - -package org.opensolaris.os.adr.adrgen; - -import org.opensolaris.os.adr.*; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.InputStream; -import org.w3c.dom.Document; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerConfigurationException; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamSource; -import javax.xml.transform.stream.StreamResult; - -public class DocGenerator { - - enum Format { NONE, TEXT, DOCBOOK }; - private static final String RMFMT = "ADRrmdoc.xsl"; - private static final String DBFMT = "ADRdocbook.xsl"; - private static final String TXTFMT = "ADRtext.xsl"; - - static void generate(ADRGen parser, Format doc_fmt) - throws FileNotFoundException, TransformerException, - TransformerConfigurationException { - StreamResult output = new StreamResult(System.out); - String resource; - if (doc_fmt == Format.DOCBOOK) - resource = DBFMT; - else if (doc_fmt == Format.TEXT) - resource = TXTFMT; - else - resource = RMFMT; - InputStream is = DocGenerator.class.getResourceAsStream(resource); - StreamSource stylesource = new StreamSource(is); - - TransformerFactory tFactory = TransformerFactory.newInstance(); - Transformer transformer = tFactory.newTransformer(stylesource); - DOMSource source = new DOMSource(parser.doc_); - transformer.transform(source, output); - } -} diff -r 2122a04679c0 -r 8a6fba4105d7 usr/src/java/adr/org/opensolaris/os/adr/adrgen/JGenerator.java --- a/usr/src/java/adr/org/opensolaris/os/adr/adrgen/JGenerator.java Wed Mar 14 04:47:00 2012 -0700 +++ b/usr/src/java/adr/org/opensolaris/os/adr/adrgen/JGenerator.java Wed Mar 14 10:45:15 2012 -0400 @@ -20,19 +20,16 @@ */ /* - * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. */ package org.opensolaris.os.adr.adrgen; +import java.io.*; +import java.util.*; import org.opensolaris.os.adr.*; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.PrintStream; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; +import org.opensolaris.os.adr.CLI.Option; +import org.opensolaris.os.adr.Type.*; public class JGenerator { @@ -373,8 +370,8 @@ impl.format("\tif (check && NONDEF.contains(%s))\n", fallback ? "discriminant.getValue()" : "discriminant"); impl.format("\t throw new IllegalArgumentException(\n"); - impl.format("\t\t\"Bad default discriminant: \" + discriminant);\n" - ); + impl.format( + "\t\t\"Bad default discriminant: \" + discriminant);\n"); } else { impl.format(" protected %s(%s discriminant) {\n", in, disctype); } @@ -544,7 +541,7 @@ generateEnum(t); /* XXX: need to require api/feature names be "tame". */ - for (API api : iface_.getAPIs()) { + for (API api : iface_.getAPIs().values()) { String mxname = upperFirst(api.getName()) + "MXBean"; PrintStream out = newFile(mxname); generateVersions(out, api); @@ -595,4 +592,39 @@ out.close(); } } + + /** + * Performs intrinsic validation of the given spec file, then generates Java + * definitions. Note: this method does NOT validate against a schema. + * + * Usage: java ... -d [-N] [-i] + */ + public static void main(String[] args) { + CLI cli = new CLI(JGenerator.class); + Map opts = new HashMap(); + int operands = cli.getOptions(args, "d:Ni", opts); + if (operands == args.length) { + cli.die(2, "spec file not specified"); + } + + File file = new File(args[operands]); + CLI.Option d = opts.get('d'); + if (d == null) { + cli.die(2, "directory not specified"); + } + + String outDir = d.getArg(); + boolean check_nullable = opts.get('N') == null; + boolean generate_jimpl = opts.get('i') != null; + try { + ADRGen adr = new ADRGen(file, check_nullable); + new JGenerator(adr, outDir).generate(false, generate_jimpl); + } catch (ParseException e) { + cli.die(1, "error parsing file %s: %s", file, + e.getLocalizedMessage()); + } catch (FileNotFoundException e) { + cli.die(1, "error parsing file %s: %s", file, + e.getLocalizedMessage()); + } + } } diff -r 2122a04679c0 -r 8a6fba4105d7 usr/src/java/adr/org/opensolaris/os/adr/adrgen/RadADRGen.java --- a/usr/src/java/adr/org/opensolaris/os/adr/adrgen/RadADRGen.java Wed Mar 14 04:47:00 2012 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -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 (c) 2012, Oracle and/or its affiliates. All rights reserved. - */ - -package org.opensolaris.os.adr.adrgen; - -import org.opensolaris.os.adr.*; -import java.io.File; -import java.io.FileNotFoundException; -import java.net.URL; -import java.util.*; -import javax.xml.XMLConstants; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.TransformerException; -import javax.xml.validation.SchemaFactory; -import org.xml.sax.ErrorHandler; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; - -public class RadADRGen { - private static final String RADADRGEN_USAGE = "Usage: radadrgen [-N]" + - " [-c [-r [-m][-s]]] [-j dir [-i]] [-o {docbook | text | none}]" + - " [-d baseline.xml] spec.xml"; - - static class Option { - private char letter_; - private String arg_; - - Option(char letter, String arg) { - letter_ = letter; - arg_ = arg; - } - - char getLetter() { - return letter_; - } - - String getArg() { - return arg_; - } - } - - static int getOptions(String[] args, String argspec, List