︙ | | | ︙ | |
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);
|
︙ | | | ︙ | |