Print this page
patch fix-lint
@@ -21,16 +21,21 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
* Copyright 2012 Joshua M. Clulow <josh@sysmgr.org>
+ * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
*/
#include <libdisasm.h>
#include <stdlib.h>
#ifdef DIS_STANDALONE
#include <mdb/mdb_modapi.h>
+#define _MDB
+#include <mdb/mdb_io.h>
+#else
+#include <stdio.h>
#endif
#include "libdisasm_impl.h"
static int _dis_errno;
@@ -212,5 +217,28 @@
int
dis_instrlen(dis_handle_t *dhp, uint64_t pc)
{
return (dhp->dh_arch->da_instrlen(dhp, pc));
}
+
+int
+dis_vsnprintf(char *restrict s, size_t n, const char *restrict format,
+ va_list args)
+{
+#ifdef DIS_STANDALONE
+ return (mdb_iob_vsnprintf(s, n, format, args));
+#else
+ return (vsnprintf(s, n, format, args));
+#endif
+}
+
+int
+dis_snprintf(char *restrict s, size_t n, const char *restrict format, ...)
+{
+ va_list args;
+
+ va_start(args, format);
+ n = dis_vsnprintf(s, n, format, args);
+ va_end(args);
+
+ return (n);
+}