| ︙ | | |
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
-
|
static void FsRecacheFilesystemList(void);
static void Claim(void);
static void Disclaim(void);
static void * DivertFindSymbol(Tcl_Interp *interp,
Tcl_LoadHandle loadHandle, const char *symbol);
static void DivertUnloadFile(Tcl_LoadHandle loadHandle);
/*
* Functions that provide native filesystem support. They are private and
* should be used only here. They should be called instead of calling Tclp...
* native filesystem functions. Others should use the Tcl_FS... functions
* which ensure correct and complete virtual filesystem support.
*/
|
| ︙ | | |
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
|
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
|
-
+
|
* The basic filesystem implementation.
*/
static void
FsThrExitProc(
ClientData cd)
{
ThreadSpecificData *tsdPtr = cd;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)cd;
FilesystemRecord *fsRecPtr = NULL, *tmpFsRecPtr = NULL;
/*
* Discard the cwd copy.
*/
if (tsdPtr->cwdPathPtr != NULL) {
|
| ︙ | | |
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
|
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
|
-
+
|
/*
* Refill the cache, honouring the order.
*/
list = NULL;
fsRecPtr = tmpFsRecPtr;
while (fsRecPtr != NULL) {
tmpFsRecPtr = Tcl_Alloc(sizeof(FilesystemRecord));
tmpFsRecPtr = (FilesystemRecord *)Tcl_Alloc(sizeof(FilesystemRecord));
*tmpFsRecPtr = *fsRecPtr;
tmpFsRecPtr->nextPtr = list;
tmpFsRecPtr->prevPtr = NULL;
list = tmpFsRecPtr;
fsRecPtr = fsRecPtr->prevPtr;
}
tsdPtr->filesystemList = list;
|
| ︙ | | |
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
|
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
|
-
+
|
{
FilesystemRecord *newFilesystemPtr;
if (fsPtr == NULL) {
return TCL_ERROR;
}
newFilesystemPtr = Tcl_Alloc(sizeof(FilesystemRecord));
newFilesystemPtr = (FilesystemRecord *)Tcl_Alloc(sizeof(FilesystemRecord));
newFilesystemPtr->clientData = clientData;
newFilesystemPtr->fsPtr = fsPtr;
Tcl_MutexLock(&filesystemMutex);
newFilesystemPtr->nextPtr = filesystemList;
|
| ︙ | | |
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
|
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
|
-
-
-
+
+
+
|
static int
EvalFileCallback(
ClientData data[],
Tcl_Interp *interp,
int result)
{
Interp *iPtr = (Interp *) interp;
Tcl_Obj *oldScriptFile = data[0];
Tcl_Obj *pathPtr = data[1];
Tcl_Obj *objPtr = data[2];
Tcl_Obj *oldScriptFile = (Tcl_Obj *)data[0];
Tcl_Obj *pathPtr = (Tcl_Obj *)data[1];
Tcl_Obj *objPtr = (Tcl_Obj *)data[2];
/*
* Restore the original iPtr->scriptFile value, but because the value may
* have hanged during evaluation, don't assume it currently points to
* pathPtr.
*/
|
| ︙ | | |
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
|
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
|
+
+
|
*/
static const char *const *
NativeFileAttrStrings(
Tcl_Obj *pathPtr,
Tcl_Obj **objPtrRef)
{
(void)pathPtr;
(void)objPtrRef;
return tclpFileAttrStrings;
}
/*
*----------------------------------------------------------------------
*
* NativeFileAttrsGet --
|
| ︙ | | |
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
|
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
|
+
|
Tcl_FSUnloadFileProc **unloadProcPtr)
/* A place to store a pointer to the function
* that unloads the object. */
{
const char *symbols[3];
void *procPtrs[2];
int res;
(void)unloadProcPtr;
symbols[0] = sym1;
symbols[1] = sym2;
symbols[2] = NULL;
res = Tcl_LoadFile(interp, pathPtr, symbols, 0, procPtrs, handlePtr);
if (res == TCL_OK) {
|
| ︙ | | |
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
|
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
|
+
-
+
+
+
|
*
* 3. TCL_TEMPLOAD_NO_UNLINK is not true (an integer > 0) and AUFS filesystem can be detected (using statfs, if available).
*
*/
#ifdef hpux
(void)shlibFile;
return 1;
#else
char *skipstr = getenv("TCL_TEMPLOAD_NO_UNLINK");
if (skipstr && (skipstr[0] != '\0')) {
return atoi(skipstr);
}
#ifdef TCL_TEMPLOAD_NO_UNLINK
#ifndef TCL_TEMPLOAD_NO_UNLINK
(void)shlibFile;
#else
/* At built time TCL_TEMPLOAD_NO_UNLINK can be set manually to control whether
* this automatic overriding of unlink is included.
*/
#ifndef NO_FSTATFS
{
struct statfs fs;
/*
|
| ︙ | | |
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
|
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
|
-
+
|
goto mustCopyToTempAnyway;
}
buffer = TclpLoadMemoryGetBuffer(interp, size);
if (!buffer) {
Tcl_Close(interp, data);
goto mustCopyToTempAnyway;
}
ret = Tcl_Read(data, buffer, size);
ret = Tcl_Read(data, (char *)buffer, size);
Tcl_Close(interp, data);
ret = TclpLoadMemory(interp, buffer, size, ret, handlePtr,
&unloadProcPtr, flags);
if (ret == TCL_OK && *handlePtr != NULL) {
goto resolveSymbols;
}
}
|
| ︙ | | |
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
|
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
|
-
+
|
return TCL_OK;
}
/*
* Divert the unloading in order to unload and cleanup the temporary file.
*/
tvdlPtr = Tcl_Alloc(sizeof(FsDivertLoad));
tvdlPtr = (FsDivertLoad *)Tcl_Alloc(sizeof(FsDivertLoad));
/*
* Remember three pieces of information in order to clean up the diverted
* load completely on platforms which allow proper unloading of code.
*/
tvdlPtr->loadHandle = newLoadHandle;
|
| ︙ | | |
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
|
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
|
-
+
|
tvdlPtr->divertedFile = NULL;
tvdlPtr->divertedFilesystem = NULL;
Tcl_DecrRefCount(copyToPtr);
}
copyToPtr = NULL;
divertedLoadHandle = Tcl_Alloc(sizeof(struct Tcl_LoadHandle_));
divertedLoadHandle = (Tcl_LoadHandle)Tcl_Alloc(sizeof(struct Tcl_LoadHandle_));
divertedLoadHandle->clientData = tvdlPtr;
divertedLoadHandle->findSymbolProcPtr = DivertFindSymbol;
divertedLoadHandle->unloadFileProcPtr = DivertUnloadFile;
*handlePtr = divertedLoadHandle;
if (interp) {
Tcl_ResetResult(interp);
|
| ︙ | | |
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
|
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
|
+
|
*/
static Tcl_Obj *
NativeFilesystemSeparator(
Tcl_Obj *pathPtr)
{
const char *separator = NULL; /* lint */
(void)pathPtr;
switch (tclPlatform) {
case TCL_PLATFORM_UNIX:
separator = "/";
break;
case TCL_PLATFORM_WINDOWS:
separator = "\\";
|
| ︙ | | |