Check-in [cf56967f97]
Overview
Comment:xvfs_perror -> xvfs_strerror, which is what it should have been named
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: cf56967f9720940e43ad84db05f1d959378758506a54396c9045cf58ce0d1cb6
User & Date: rkeene on 2019-09-17 01:55:20
Other Links: manifest | tags
Context
2019-09-17
05:06
Undefine macros because we may concatencat translation units in some modes check-in: 5f2895faba user: rkeene tags: trunk
01:55
xvfs_perror -> xvfs_strerror, which is what it should have been named check-in: cf56967f97 user: rkeene tags: trunk
01:53
Improved server mode to register all of //xvfs:/ check-in: f1d16a3958 user: rkeene tags: trunk
Changes

Modified xvfs-core.c from [9a0cfd6536] to [37f3df09d1].

148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
		case XVFS_RV_ERR_INTERNAL:
			return(EINVAL);
		default:
			return(ERANGE);
	}
}

static const char *xvfs_perror(int xvfs_error) {
	if (xvfs_error >= 0) {
		return("Not an error");
	}

	switch (xvfs_error) {
		case XVFS_RV_ERR_ENOENT:
		case XVFS_RV_ERR_EINVAL:







|







148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
		case XVFS_RV_ERR_INTERNAL:
			return(EINVAL);
		default:
			return(ERANGE);
	}
}

static const char *xvfs_strerror(int xvfs_error) {
	if (xvfs_error >= 0) {
		return("Not an error");
	}

	switch (xvfs_error) {
		case XVFS_RV_ERR_ENOENT:
		case XVFS_RV_ERR_EINVAL:
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188

static void xvfs_setresults_error(Tcl_Interp *interp, int xvfs_error) {
	if (!interp) {
		return;
	}

	Tcl_SetErrno(xvfs_errorToErrno(xvfs_error));
	Tcl_SetResult(interp, (char *) xvfs_perror(xvfs_error), NULL);

	return;
}

/*
 * Xvfs Memory Channel
 */







|







174
175
176
177
178
179
180
181
182
183
184
185
186
187
188

static void xvfs_setresults_error(Tcl_Interp *interp, int xvfs_error) {
	if (!interp) {
		return;
	}

	Tcl_SetErrno(xvfs_errorToErrno(xvfs_error));
	Tcl_SetResult(interp, (char *) xvfs_strerror(xvfs_error), NULL);

	return;
}

/*
 * Xvfs Memory Channel
 */
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
	int statRet;

	XVFS_DEBUG_ENTER;
	XVFS_DEBUG_PRINTF("Opening file \"%s\" ...", Tcl_GetString(path));

	statRet = instanceInfo->fsInfo->getStatProc(Tcl_GetString(path), &fileInfo);
	if (statRet < 0) {
		XVFS_DEBUG_PRINTF("... failed: %s", xvfs_perror(statRet));

		xvfs_setresults_error(interp, XVFS_RV_ERR_ENOENT);

		XVFS_DEBUG_LEAVE;
		return(NULL);
	}








|







210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
	int statRet;

	XVFS_DEBUG_ENTER;
	XVFS_DEBUG_PRINTF("Opening file \"%s\" ...", Tcl_GetString(path));

	statRet = instanceInfo->fsInfo->getStatProc(Tcl_GetString(path), &fileInfo);
	if (statRet < 0) {
		XVFS_DEBUG_PRINTF("... failed: %s", xvfs_strerror(statRet));

		xvfs_setresults_error(interp, XVFS_RV_ERR_ENOENT);

		XVFS_DEBUG_LEAVE;
		return(NULL);
	}

514
515
516
517
518
519
520
521
522
523
524
525
526
527
528

	path = xvfs_absolutePath(path);

	pathStr = xvfs_relativePath(path, instanceInfo);

	retval = instanceInfo->fsInfo->getStatProc(pathStr, statBuf);
	if (retval < 0) {
		XVFS_DEBUG_PRINTF("... failed: %s", xvfs_perror(retval));

		Tcl_SetErrno(xvfs_errorToErrno(retval));

		retval = -1;
	} else {
		XVFS_DEBUG_PUTS("... ok");
	}







|







514
515
516
517
518
519
520
521
522
523
524
525
526
527
528

	path = xvfs_absolutePath(path);

	pathStr = xvfs_relativePath(path, instanceInfo);

	retval = instanceInfo->fsInfo->getStatProc(pathStr, statBuf);
	if (retval < 0) {
		XVFS_DEBUG_PRINTF("... failed: %s", xvfs_strerror(retval));

		Tcl_SetErrno(xvfs_errorToErrno(retval));

		retval = -1;
	} else {
		XVFS_DEBUG_PUTS("... ok");
	}
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
		XVFS_DEBUG_LEAVE;
		return(TCL_OK);
	}

	childrenCount = 0;
	children = instanceInfo->fsInfo->getChildrenProc(pathStr, &childrenCount);
	if (childrenCount < 0) {
		XVFS_DEBUG_PRINTF("... error: %s", xvfs_perror(childrenCount));

		Tcl_DecrRefCount(path);

		xvfs_setresults_error(interp, childrenCount);

		XVFS_DEBUG_LEAVE;
		return(TCL_ERROR);







|







761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
		XVFS_DEBUG_LEAVE;
		return(TCL_OK);
	}

	childrenCount = 0;
	children = instanceInfo->fsInfo->getChildrenProc(pathStr, &childrenCount);
	if (childrenCount < 0) {
		XVFS_DEBUG_PRINTF("... error: %s", xvfs_strerror(childrenCount));

		Tcl_DecrRefCount(path);

		xvfs_setresults_error(interp, childrenCount);

		XVFS_DEBUG_LEAVE;
		return(TCL_ERROR);