10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
+
+
+
|
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <fuse.h>
#include <pwd.h>
#include <tcl.h>
/* From sha1.c */
int Sha1_Init(Tcl_Interp *interp);
#ifndef APPFS_CACHEDIR
#define APPFS_CACHEDIR "/var/cache/appfs"
#endif
#ifdef DEBUG
#define APPFS_DEBUG(x...) { fprintf(stderr, "[debug] %s:%i:%s: ", __FILE__, __LINE__, __func__); fprintf(stderr, x); fprintf(stderr, "\n"); }
#else
|
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
+
+
+
+
+
+
+
+
+
+
+
|
return(NULL);
}
tcl_ret = Tcl_Init(interp);
if (tcl_ret != TCL_OK) {
fprintf(stderr, "Unable to initialize Tcl. Aborting.\n");
fprintf(stderr, "Tcl Error is: %s\n", Tcl_GetStringResult(interp));
Tcl_DeleteInterp(interp);
return(NULL);
}
tcl_ret = Tcl_Eval(interp, "package ifneeded sha1 1.0 [list load {} sha1]");
if (tcl_ret != TCL_OK) {
fprintf(stderr, "Unable to initialize Tcl SHA1. Aborting.\n");
fprintf(stderr, "Tcl Error is: %s\n", Tcl_GetStringResult(interp));
Tcl_DeleteInterp(interp);
return(NULL);
}
tcl_ret = Tcl_Eval(interp, ""
|
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
|
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
|
+
+
|
char dbfilename[1024];
int pthread_ret, snprintf_ret, sqlite_ret;
globalThread.cachedir = cachedir;
globalThread.boottime = time(NULL);
globalThread.platform = "linux-x86_64";
globalThread.options.writable = 1;
Tcl_StaticPackage(NULL, "sha1", Sha1_Init, NULL);
pthread_ret = pthread_key_create(&interpKey, NULL);
if (pthread_ret != 0) {
fprintf(stderr, "Unable to create TSD key for Tcl. Aborting.\n");
return(1);
}
|