Exemple #1
0
static int
sli_open_backing_file(struct fidc_membh *f)
{
	int lvl = PLL_DIAG, incr, rc = 0;
	char fidfn[PATH_MAX];

	/*
 	 * XXX hit setrlimit: operation not permitted, but no open-fail.
 	 * This per open system call should go!  Hit again due to fs.nr_open
 	 * sysctl limit.
 	 */
	incr = psc_rlim_adj(RLIMIT_NOFILE, 1);
	sli_fg_makepath(&f->fcmh_fg, fidfn);
	fcmh_2_fd(f) = open(fidfn, O_CREAT|O_RDWR, 0600);
	if (fcmh_2_fd(f) == -1) {
		rc = errno;
		if (incr)
			psc_rlim_adj(RLIMIT_NOFILE, -1);
		OPSTAT_INCR("open-fail");
		lvl = PLL_WARN;
	} else
		OPSTAT_INCR("open-succeed");
	psclog(lvl, "opened backing file path=%s fd=%d rc=%d",
	    strstr(fidfn, SL_RPATH_FIDNS_DIR), fcmh_2_fd(f), rc);
	return (rc);
}
void
libcfs_ssl_logerr(int level, SSL *ssl, int code)
{
#define ERRBUF_LEN 256
	int xcode = SSL_get_error(ssl, code);
	char sbuf[ERRBUF_LEN];

	if (ERR_error_string(ERR_get_error(), sbuf) == NULL)
		psclog_error("unable to get SSL error");
	psclog(level, "ssl error: %s (%d)", sbuf, xcode);
}
static int
sli_open_backing_file(struct fidc_membh *f)
{
	int lvl = PLL_DIAG, incr, rc = 0;
	char fidfn[PATH_MAX];

	incr = psc_rlim_adj(RLIMIT_NOFILE, 1);
	sli_fg_makepath(&f->fcmh_fg, fidfn);
	fcmh_2_fd(f) = open(fidfn, O_CREAT|O_RDWR, 0600);
	if (fcmh_2_fd(f) == -1) {
		rc = errno;
		if (incr)
			psc_rlim_adj(RLIMIT_NOFILE, -1);
		OPSTAT_INCR("open-fail");
		lvl = PLL_WARN;
	} else
		OPSTAT_INCR("open-succeed");
	psclog(lvl, "opened backing file path=%s fd=%d rc=%d",
	    strstr(fidfn, SL_RPATH_FIDNS_DIR), fcmh_2_fd(f), rc);
	return (rc);
}