Print this page
195 Need replacement for nfs/lockd+klm

@@ -16,12 +16,14 @@
  * 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.
  */
 #include <stdio.h>
 #include <stdlib.h>
 #include <syslog.h>
 #include <stdarg.h>

@@ -356,10 +358,31 @@
 {
         return (fs_smf_get_prop(NFS_SMF, prop_name, propbuf,
             instance, sctype, svc_name, bufsz));
 }
 
+/* Get an integer (base 10) property */
+int
+nfs_smf_get_iprop(char *prop_name, int *rvp, char *instance,
+    scf_type_t sctype, char *svc_name)
+{
+        char propbuf[32];
+        int bufsz, rc, val;
+
+        bufsz = sizeof (propbuf);
+        rc = fs_smf_get_prop(NFS_SMF, prop_name, propbuf,
+            instance, sctype, svc_name, &bufsz);
+        if (rc != SA_OK)
+                return (rc);
+        errno = 0;
+        val = strtol(propbuf, NULL, 10);
+        if (errno != 0)
+                return (SA_BAD_VALUE);
+        *rvp = val;
+        return (SA_OK);
+}
+
 int
 nfs_smf_set_prop(char *prop_name, char *value, char *instance,
     scf_type_t type, char *svc_name)
 {
         return (fs_smf_set_prop(NFS_SMF, prop_name, value, instance,