Пример #1
0
static boolean_t
do_getset(int fd, int cmd, char *buf, int buf_len)
{
	char	*cp;
	struct strioctl	stri;
	boolean_t	is_name_get;

	if (is_obsolete(buf))
		return (B_TRUE);

	stri.ic_cmd = cmd;
	stri.ic_timout = 0;
	stri.ic_len = buf_len;
	stri.ic_dp = buf;
	is_name_get = stri.ic_cmd == ND_GET && buf[0] == '?' && buf[1] == '\0';

	if (ioctl(fd, I_STR, &stri) == -1) {
		if (errno == ENOENT)
			(void) printf("name is non-existent for this module\n"
			    "for a list of valid names, use name '?'\n");
		else
			(void) printf("operation failed: %s\n", errmsg(errno));
		return (B_FALSE);
	}
	if (is_name_get)
		name_print(buf);
	else if (stri.ic_cmd == ND_GET) {
		for (cp = buf; *cp != '\0'; cp += strlen(cp) + 1)
			(void) puts(cp);
	}
	(void) fflush(stdout);
	return (B_TRUE);
}
Пример #2
0
void error_print_nolock(char *str, bool use_errno){
	name_print(stderr);
	fprintf(stderr, "ERROR:");
	if(use_errno)
		perror(str);
	else
		fprintf(stderr, "%s\n",str);
	fflush(stderr);
}
Пример #3
0
void info_print_nolock(char *str){
	name_print(stderr);
	fprintf(stderr, "INFO:%s\n",str);
	fflush(stderr);
}