Check-in [013d6b36f4]
Overview
Comment:Updated to use "/proc/self/exe" rather than "/proc/<pid>/exe"

Updated to check for "/proc/curproc/file" (FreeBSD)

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 013d6b36f4f4223a937b04b8a872164a9ec92545
User & Date: rkeene on 2010-09-26 04:50:35
Other Links: manifest | tags
Context
2010-09-26
04:50
Added first draft of kitdll check-in: 029b69f827 user: rkeene tags: trunk
04:50
Updated to use "/proc/self/exe" rather than "/proc/<pid>/exe"

Updated to check for "/proc/curproc/file" (FreeBSD) check-in: 013d6b36f4 user: rkeene tags: trunk

04:50
Updated to remove kitdll from releases since it is currently incomplete check-in: 914a6c9397 user: rkeene tags: trunk
Changes

Modified kitsh/buildsrc/kitsh-0.0/configure.ac from [e12a8b84bb] to [d545ae6633].

39
40
41
42
43
44
45
46

47
48
49
50
51
52
53
39
40
41
42
43
44
45

46
47
48
49
50
51
52
53







-
+







AC_CHECK_FUNCS(Tcl_SetStartupScript TclSetStartupScriptPath)
dnl Check for the ability to get the current system encoding
AC_CHECK_FUNCS(Tcl_GetEncodingNameFromEnvironment Tcl_SetSystemEncoding)
LIBS="${SAVE_LIBS}"

dnl Check for optional headers
AC_HEADER_STDC
AC_CHECK_HEADERS(unistd.h)
AC_CHECK_HEADERS(unistd.h string.h strings.h)

dnl Check for optional system calls
AC_CHECK_FUNCS(readlink)

dnl Check for acceptable dladdr so we can find ourselves on Solaris
DC_CHECK_FOR_ACCEPTABLE_DLADDR

Modified kitsh/buildsrc/kitsh-0.0/kitInit.c from [534a43d0fd] to [4d11547632].

32
33
34
35
36
37
38






39
40
41
42
43
44
45
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51







+
+
+
+
+
+







#endif /* MB_TASKMODAL */

#include "tclInt.h"

#ifdef HAVE_UNISTD_H
#  include <unistd.h>
#endif
#ifdef HAVE_STRING_H
#  include <string.h>
#endif
#ifdef HAVE_STRINGS_H
#  include <strings.h>
#endif

/* For dladdr() and Dl_info */
#ifdef HAVE_DLFCN_H
#  include <dlfcn.h>
#endif

#if defined(HAVE_TCL_GETENCODINGNAMEFROMENVIRONMENT) && defined(HAVE_TCL_SETSYSTEMENCODING)
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219

220
221
222












223
224
225


226

227
228
229
230
231
232
233
208
209
210
211
212
213
214

215

216
217
218
219
220
221
222
223
224



225
226
227
228
229
230
231
232
233
234
235
236
237


238
239
240
241
242
243
244
245
246
247
248







-

-








+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+

-
-
+
+

+








static void FindAndSetExecName(Tcl_Interp *interp) {
	int len = 0;
	Tcl_Obj *execNameObj;
	Tcl_Obj *lobjv[1];
#ifdef HAVE_READLINK
	ssize_t readlink_ret;
	char procpath[4096];
	char exe_buf[4096];
	int snprintf_ret;
#endif /* HAVE_READLINK */
#ifdef HAVE_ACCEPTABLE_DLADDR
	Dl_info syminfo;
	int dladdr_ret;
#endif /* HAVE_ACCEPTABLE_DLADDR */ 

#ifdef HAVE_READLINK
	if (Tcl_GetNameOfExecutable() == NULL) {
		readlink_ret = readlink("/proc/self/exe", exe_buf, sizeof(exe_buf) - 1);
		snprintf_ret = snprintf(procpath, sizeof(procpath), "/proc/%lu/exe", (unsigned long) getpid());
		if (snprintf_ret < sizeof(procpath)) {
			readlink_ret = readlink(procpath, exe_buf, sizeof(exe_buf) - 1);

		if (readlink_ret > 0 && readlink_ret < (sizeof(exe_buf) - 1)) {
			exe_buf[readlink_ret] = '\0';

			SetExecName(interp, exe_buf);

			return;
		}
	}

	if (Tcl_GetNameOfExecutable() == NULL) {
		readlink_ret = readlink("/proc/curproc/file", exe_buf, sizeof(exe_buf) - 1);

			if (readlink_ret > 0 && readlink_ret < (sizeof(exe_buf) - 1)) {
				exe_buf[readlink_ret] = '\0';
		if (readlink_ret > 0 && readlink_ret < (sizeof(exe_buf) - 1)) {
			exe_buf[readlink_ret] = '\0';

			if (strcmp(exe_buf, "unknown") != 0) {
				SetExecName(interp, exe_buf);

				return;
			}
		}
	}
#endif /* HAVE_READLINK */