From a9165016b8955d5ed48c7a3c58842b579d931fc6 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Fri, 18 Sep 2015 17:45:34 -0400 Subject: Massive documentation and copyright clean-up. --- sd_daemon/notify.go | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'sd_daemon/notify.go') diff --git a/sd_daemon/notify.go b/sd_daemon/notify.go index a038f54..8fce6da 100644 --- a/sd_daemon/notify.go +++ b/sd_daemon/notify.go @@ -14,7 +14,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package sd_daemon +package sd import ( "errors" @@ -22,11 +22,22 @@ import ( "os" ) -// ErrNotifyNoSocket is an error returned if no socket was specified. -var ErrNotifyNoSocket = errors.New("No socket") +// errNotifyNoSocket is an error returned if no socket was specified. +var errNotifyNoSocket = errors.New("No socket") -// Notify sends a message to the init daemon. It is common to ignore -// the error. +// Notify sends a message to the service manager aobout state +// changes. It is common to ignore the error. +// +// If unsetEnv is true, then (regarless of whether the function call +// itself succeeds or not) it will unset the environmental variable +// NOTIFY_SOCKET, which will cause further calls to this function to +// fail. +// +// The state parameter should countain a newline-separated list of +// variable assignments. +// +// See the documentation for sd_notify(3) for well-known variable +// assignments. func Notify(unsetEnv bool, state string) error { if unsetEnv { defer os.Unsetenv("NOTIFY_SOCKET") @@ -38,7 +49,7 @@ func Notify(unsetEnv bool, state string) error { } if socketAddr.Name == "" { - return ErrNotifyNoSocket + return errNotifyNoSocket } conn, err := net.DialUnix(socketAddr.Net, nil, socketAddr) -- cgit v1.2.3-54-g00ecf