summaryrefslogtreecommitdiff
path: root/sd_daemon/notify.go
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2015-09-18 17:45:34 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2015-09-18 17:45:34 -0400
commita9165016b8955d5ed48c7a3c58842b579d931fc6 (patch)
tree485d32f014a3dc4c4c6da847c653dfd7d1e589b1 /sd_daemon/notify.go
parenta5bad9d6ec4ce526015403c9565efea58d2867ea (diff)
Massive documentation and copyright clean-up.
Diffstat (limited to 'sd_daemon/notify.go')
-rw-r--r--sd_daemon/notify.go23
1 files changed, 17 insertions, 6 deletions
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)