Check-in [cc9b79793c]
Overview
Comment:First half of renaming
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: cc9b79793cc29fa3915452e50ab6763fcf1b4e7c
User & Date: rkeene on 2014-10-24 20:12:14
Other Links: manifest | tags
Context
2014-10-24
20:13
Completed rename check-in: 5d8baf9914 user: rkeene tags: trunk
20:12
First half of renaming check-in: cc9b79793c user: rkeene tags: trunk
2012-09-17
13:36
Updated to return correct value from close handler check-in: 6ad41a2c2b user: rkeene tags: trunk
Changes

Added .fossil-settings/ignore-glob version [8823994c8d].

            1  +tuapi.so
            2  +libtuapi.a
            3  +tuapi.o
            4  +tuapi.tcl.h
            5  +pkgIndex.tcl

Modified build-common.sh from [1b93b7f590] to [4e129d0a2f].

     1      1   #! /bin/bash
     2      2   
     3      3   set -e
     4      4   
     5      5   case "$1" in
     6      6   	clean|distclean)
     7      7   		rm -rf out inst
     8         -		rm -f libsystem.a system.o system.so
     9         -		rm -f system.tcl.h
            8  +		rm -f libtuapi.a tuapi.o tuapi.so
            9  +		rm -f tuapi.tcl.h
    10     10   		exit 0
    11     11   		;;
    12     12   esac
    13     13   
    14         -./stringify.tcl system.tcl > system.tcl.h
           14  +tuapi_version="$(grep Tcl_PkgProvide system.c | awk '{ print $3 }' | sed 's@[");]*@@g')"
           15  +
           16  +./stringify.tcl system.tcl > tuapi.tcl.h

Modified build-dyn.sh from [3cc9484186] to [68b9f210b2].

     4      4   . build-common.sh
     5      5   
     6      6   # Compile using the same options as Tcl
     7      7   TCLCONFIGSH="$(find /usr/lib /usr/lib64 /usr/local/lib /usr/local/lib64 /lib /lib64 -name tclConfig.sh -print -quit)"
     8      8   
     9      9   . "${TCLCONFIGSH}"
    10     10   
    11         -echo "${TCL_CC} -ggdb3 -fPIC -DPIC -Wall -DUSE_TCL_STUBS=1 ${TCL_DEFS} ${TCL_INCLUDE_SPEC} ${TCL_STUB_LIB_SPEC} -shared -rdynamic -o system.so system.c"
    12         -eval ${TCL_CC} -ggdb3 -fPIC -DPIC -Wall -DUSE_TCL_STUBS=1 ${TCL_DEFS} ${TCL_INCLUDE_SPEC} ${TCL_STUB_LIB_SPEC} -shared -rdynamic -o system.so system.c
           11  +echo "${TCL_CC} -ggdb3 -fPIC -DPIC -Wall -DUSE_TCL_STUBS=1 ${TCL_DEFS} ${TCL_INCLUDE_SPEC} ${TCL_STUB_LIB_SPEC} -shared -rdynamic -o tuapi.so system.c"
           12  +eval ${TCL_CC} -ggdb3 -fPIC -DPIC -Wall -DUSE_TCL_STUBS=1 ${TCL_DEFS} ${TCL_INCLUDE_SPEC} ${TCL_STUB_LIB_SPEC} -shared -rdynamic -o tuapi.so system.c
           13  +
           14  +echo 'package ifneeded tuapi '"${tuapi_version}"' [list load [file join $dir tuapi.so]]' > pkgIndex.tcl

Modified build-static.sh from [a001c327e9] to [8d87567e49].

     3      3   # Perform common build options
     4      4   . build-common.sh
     5      5   
     6      6   # Define variables
     7      7   KITCREATORROOT="$(readlink -f '..')"
     8      8   
     9      9   # Compile using the same options as Tcl
    10         -TCLCONFIGSH='/usr/lib/tclConfig.sh'
           10  +TCLCONFIGSH='/usr/lib64/tclConfig.sh'
    11     11   
    12     12   . "${TCLCONFIGSH}"
    13     13   
    14         -echo "diet ${TCL_CC} ${TCL_DEFS} ${TCL_INCLUDE_SPEC} -o system.o -c system.c"
    15         -eval diet ${TCL_CC} ${TCL_DEFS} ${TCL_INCLUDE_SPEC} -o system.o -c system.c
    16         -ar rcu libsystem.a system.o
    17         -ranlib libsystem.a
           14  +echo "${TCL_CC} ${TCL_DEFS} ${TCL_INCLUDE_SPEC} -o tuapi.o -c system.c"
           15  +eval ${TCL_CC} ${TCL_DEFS} ${TCL_INCLUDE_SPEC} -o tuapi.o -c system.c
           16  +ar rcu libtuapi.a tuapi.o
           17  +ranlib libtuapi.a
           18  +echo 'package ifneeded tuapi '"${tuapi_version}"' [list load {} tuapi]' > pkgIndex.tcl

Modified build.sh from [ad274edd90] to [a96c51243e].

     7      7   KITCREATORROOT="$(readlink -f '..')"
     8      8   
     9      9   # Compile using the same options as Tcl
    10     10   TCLCONFIGSH="${KITCREATORROOT}/tcl/inst/lib/tclConfig.sh"
    11     11   
    12     12   . "${TCLCONFIGSH}"
    13     13   
    14         -echo "${TCL_CC} ${TCL_DEFS} ${TCL_INCLUDE_SPEC} -o system.o -c system.c"
    15         -eval ${TCL_CC} ${TCL_DEFS} ${TCL_INCLUDE_SPEC} -o system.o -c system.c
    16         -ar rcu libsystem.a system.o
    17         -ranlib libsystem.a
           14  +echo "${TCL_CC} ${TCL_DEFS} ${TCL_INCLUDE_SPEC} -o tuapi.o -c system.c"
           15  +eval ${TCL_CC} ${TCL_DEFS} ${TCL_INCLUDE_SPEC} -o tuapi.o -c system.c
           16  +ar rcu libtuapi.a tuapi.o
           17  +ranlib libtuapi.a
           18  +
           19  +echo 'package ifneeded tuapi '"${tuapi_version}"' [list load {} tuapi]' > pkgIndex.tcl
    18     20   
    19         -mkdir -p inst/lib/system1.0
    20         -mkdir -p out/lib/system1.0
    21         -cp libsystem.a inst/lib/system1.0
    22         -cp pkgIndex.tcl out/lib/system1.0
           21  +mkdir -p inst/lib/tuapi-0.1
           22  +mkdir -p out/lib/tuapi-0.1
           23  +cp libtuapi.a inst/lib/tuapi-0.1
           24  +cp pkgIndex.tcl out/lib/tuapi-0.1

Deleted pkgIndex.tcl version [1495e7ac95].

     1         -package ifneeded system 0.1 [list load "" system]

Modified system.c from [1a6534ed63] to [1dceb1e290].

    66     66   	return(syscall(SYS_pivot_root, new_root, put_old));
    67     67   }
    68     68   #endif
    69     69   
    70     70   /*
    71     71    * Simple hash routine to enable switching on a string to be implemented
    72     72    */
    73         -static unsigned long tclsystem_internal_simplehash(const void *databuf, int datalen) {
           73  +static unsigned long tuapi_internal_simplehash(const void *databuf, int datalen) {
    74     74   	unsigned long retval = 0;
    75     75   	const unsigned char *data;
    76     76   
    77     77   	data = databuf;
    78     78   
    79     79   	for (; datalen > 0; datalen--,data++) {
    80     80   		retval ^= (retval >> 25) & 0x7F;
................................................................................
    82     82   		retval &= (0xFFFFFFFFUL);
    83     83   		retval ^= *data;
    84     84   	}
    85     85   
    86     86   	return(retval);
    87     87   }
    88     88   
    89         -static unsigned long tclsystem_internal_simplehash_obj(Tcl_Obj *tcl_data) {
           89  +static unsigned long tuapi_internal_simplehash_obj(Tcl_Obj *tcl_data) {
    90     90   	unsigned long retval;
    91     91   	char *data;
    92     92   	int datalen = -1;
    93     93   
    94     94   	data = Tcl_GetStringFromObj(tcl_data, &datalen);
    95     95   
    96         -	retval = tclsystem_internal_simplehash(data, datalen);
           96  +	retval = tuapi_internal_simplehash(data, datalen);
    97     97   
    98     98   	return(retval);
    99     99   }
   100    100   
   101    101   #if 0
   102    102   /* NOTUSED: Uncomment when needed: */
   103         -static unsigned long tclsystem_internal_simplehash_str(const char *data) {
          103  +static unsigned long tuapi_internal_simplehash_str(const char *data) {
   104    104   	unsigned long retval;
   105    105   	int datalen;
   106    106   
   107    107   	datalen = strlen(data);
   108    108   
   109         -	retval = tclsystem_internal_simplehash(data, datalen);
          109  +	retval = tuapi_internal_simplehash(data, datalen);
   110    110   
   111    111   	return(retval);
   112    112   }
   113    113   #endif
   114    114   
   115         -static int tclsystem_internalproc_simplehash(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
          115  +static int tuapi_internalproc_simplehash(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
   116    116   	unsigned long hashval;
   117    117   	Tcl_Obj *hashval_obj;
   118    118   
   119    119   	if (objc != 2) {
   120         -		Tcl_SetObjResult(interp, Tcl_NewStringObj("wrong # args: should be \"::system::internal::hash value\"", -1));
          120  +		Tcl_SetObjResult(interp, Tcl_NewStringObj("wrong # args: should be \"::tuapi::internal::hash value\"", -1));
   121    121   
   122    122   		return(TCL_ERROR);
   123    123   	}
   124    124   
   125         -	hashval = tclsystem_internal_simplehash_obj(objv[1]);
          125  +	hashval = tuapi_internal_simplehash_obj(objv[1]);
   126    126   
   127    127   	hashval_obj = Tcl_NewObj();
   128    128   	Tcl_SetWideIntObj(hashval_obj, hashval);
   129    129   
   130    130   	Tcl_SetObjResult(interp, hashval_obj);
   131    131   
   132    132   	return(TCL_OK);
   133    133   }
   134    134   
   135         -static int tclsystem_internal_getsock(int *sock_v4_out, int *sock_v6_out) {
          135  +static int tuapi_internal_getsock(int *sock_v4_out, int *sock_v6_out) {
   136    136   	int sock_v4 = -1, sock_v6 = -1;
   137    137   	int sock;
   138    138   
   139    139   	if (sock_v4_out == NULL && sock_v6_out == NULL) {
   140    140   		return(-1);
   141    141   	}
   142    142   
................................................................................
   181    181   /*
   182    182    * Low-level System Call Wrapper Procedures
   183    183    *
   184    184    * These procedures should minimally wrap Linux or UNIX system calls to
   185    185    * expose to the Tcl-level.  Where possible accept symbolic names rather
   186    186    * than numeric values (.e.g, list of values to OR together to get flags).
   187    187    */
   188         -static int tclsystem_mount(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
          188  +static int tuapi_mount(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
   189    189   	Tcl_Obj *mountflags_obj, **mountflags_list, *mountflag;
   190    190   	int mountflags_list_len;
   191    191   	char *source, *target, *fstype;
   192    192   	unsigned long mountflags = 0;
   193    193   	void *data = NULL;
   194    194   	int mount_ret, tcl_ret;
   195    195   
   196    196   	if (objc < 5 || objc > 6) {
   197         -		Tcl_SetObjResult(interp, Tcl_NewStringObj("wrong # args: should be \"::system::syscall::mount source target fstype mountflags ?data?\"", -1));
          197  +		Tcl_SetObjResult(interp, Tcl_NewStringObj("wrong # args: should be \"::tuapi::syscall::mount source target fstype mountflags ?data?\"", -1));
   198    198   
   199    199   		return(TCL_ERROR);
   200    200   	}
   201    201   
   202    202   	source = Tcl_GetString(objv[1]);
   203    203   	target = Tcl_GetString(objv[2]);
   204    204   	fstype = Tcl_GetString(objv[3]);
................................................................................
   212    212   	if (tcl_ret != TCL_OK) {
   213    213   		return(tcl_ret);
   214    214   	}
   215    215   
   216    216   	for (; mountflags_list_len > 0; mountflags_list_len--,mountflags_list++) {
   217    217   		mountflag = mountflags_list[0];
   218    218   
   219         -		switch (tclsystem_internal_simplehash_obj(mountflag)) {
          219  +		switch (tuapi_internal_simplehash_obj(mountflag)) {
   220    220   #ifdef MS_BIND
   221    221   			case 0x8526744: /* BIND */
   222    222   				mountflags |= MS_BIND;
   223    223   				break;
   224    224   #endif
   225    225   #ifdef MS_DIRSYNC
   226    226   			case 0x2aff41c3: /* DIRSYNC */
................................................................................
   308    308   	}
   309    309   
   310    310   	Tcl_SetObjResult(interp, Tcl_NewStringObj(target, -1));
   311    311   
   312    312   	return(TCL_OK);
   313    313   }
   314    314   
   315         -static int tclsystem_umount(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
          315  +static int tuapi_umount(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
   316    316   	Tcl_Obj **flags, *flag;
   317    317   	Tcl_Obj *pathname_obj;
   318    318   	char *pathname;
   319    319   	int umount2_flags = 0;
   320    320   	int flags_cnt;
   321    321   	int chk_ret, tcl_ret;
   322    322   
   323    323   	if (objc < 2 || objc > 3) {
   324         -		Tcl_SetObjResult(interp, Tcl_NewStringObj("wrong # args: should be \"system::syscall::umount dir ?flags?\"", -1));
          324  +		Tcl_SetObjResult(interp, Tcl_NewStringObj("wrong # args: should be \"tuapi::syscall::umount dir ?flags?\"", -1));
   325    325   
   326    326   		return(TCL_ERROR);
   327    327   	}
   328    328   
   329    329   	pathname_obj = objv[1];
   330    330   	pathname = Tcl_GetString(pathname_obj);
   331    331   
................................................................................
   337    337   		if (tcl_ret != TCL_OK) {
   338    338   			return(tcl_ret);
   339    339   		}
   340    340   
   341    341   		for (; flags_cnt > 0; flags_cnt--,flags++) {
   342    342   			flag = flags[0];
   343    343   
   344         -			switch (tclsystem_internal_simplehash_obj(flag)) {
          344  +			switch (tuapi_internal_simplehash_obj(flag)) {
   345    345   				case 0x69f4a3c5: /* FORCE */
   346    346   					umount2_flags |= MNT_FORCE;
   347    347   
   348    348   					break;
   349    349   				case 0x5a9173c8: /* DETACH */
   350    350   					umount2_flags |= MNT_DETACH;
   351    351   
................................................................................
   378    378   
   379    379   		return(TCL_ERROR);
   380    380   	}
   381    381   
   382    382   	return(TCL_OK);
   383    383   }
   384    384   
   385         -static int tclsystem_swapon(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
          385  +static int tuapi_swapon(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
   386    386   	char *pathname;
   387    387   	int chk_ret;
   388    388   
   389    389   	if (objc != 2) {
   390         -		Tcl_SetObjResult(interp, Tcl_NewStringObj("wrong # args: should be \"system::syscall::swapon pathname\"", -1));
          390  +		Tcl_SetObjResult(interp, Tcl_NewStringObj("wrong # args: should be \"tuapi::syscall::swapon pathname\"", -1));
   391    391   
   392    392   		return(TCL_ERROR);
   393    393   	}
   394    394   
   395    395   	pathname = Tcl_GetString(objv[1]);
   396    396   
   397    397   	chk_ret = swapon(pathname, 0);
................................................................................
   400    400   
   401    401   		return(TCL_ERROR);
   402    402   	}
   403    403   
   404    404   	return(TCL_OK);
   405    405   }
   406    406   
   407         -static int tclsystem_swapoff(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
          407  +static int tuapi_swapoff(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
   408    408   	char *pathname;
   409    409   	int chk_ret;
   410    410   
   411    411   	if (objc != 2) {
   412         -		Tcl_SetObjResult(interp, Tcl_NewStringObj("wrong # args: should be \"system::syscall::swapoff pathname\"", -1));
          412  +		Tcl_SetObjResult(interp, Tcl_NewStringObj("wrong # args: should be \"tuapi::syscall::swapoff pathname\"", -1));
   413    413   
   414    414   		return(TCL_ERROR);
   415    415   	}
   416    416   
   417    417   	pathname = Tcl_GetString(objv[1]);
   418    418   
   419    419   	chk_ret = swapoff(pathname);
................................................................................
   422    422   
   423    423   		return(TCL_ERROR);
   424    424   	}
   425    425   
   426    426   	return(TCL_OK);
   427    427   }
   428    428   
   429         -static int tclsystem_insmod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
          429  +static int tuapi_insmod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
   430    430   	Tcl_Channel fd;
   431    431   	Tcl_Obj *module_filename, *module_data;
   432    432   	void *module_data_val;
   433    433   	int module_data_len;
   434    434   	int read_ret, chk_ret;
   435    435   
   436    436   	if (objc < 2) {
   437         -		Tcl_SetObjResult(interp, Tcl_NewStringObj("wrong # args: should be \"system::syscall::insmod filename ?args ...?\"", -1));
          437  +		Tcl_SetObjResult(interp, Tcl_NewStringObj("wrong # args: should be \"tuapi::syscall::insmod filename ?args ...?\"", -1));
   438    438   
   439    439   		return(TCL_ERROR);
   440    440   	}
   441    441   
   442    442   	module_filename = objv[1];
   443    443   
   444    444   	fd = Tcl_FSOpenFileChannel(interp, module_filename, "r", 0600);
................................................................................
   473    473   
   474    474   		return(TCL_ERROR);
   475    475   	}
   476    476   
   477    477   	return(TCL_OK);
   478    478   }
   479    479   
   480         -static int tclsystem_rmmod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
          480  +static int tuapi_rmmod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
   481    481   	Tcl_SetObjResult(interp, Tcl_NewStringObj("not implemented", -1));
   482    482   
   483    483   	return(TCL_ERROR);
   484    484   }
   485    485   
   486         -static int tclsystem_lsmod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
          486  +static int tuapi_lsmod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
   487    487   	Tcl_SetObjResult(interp, Tcl_NewStringObj("not implemented", -1));
   488    488   
   489    489   	return(TCL_ERROR);
   490    490   }
   491    491   
   492         -static int tclsystem_hostname(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
          492  +static int tuapi_hostname(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
   493    493   	char hostname[HOST_NAME_MAX + 1];
   494    494   	int chk_ret;
   495    495   
   496    496   	if (objc == 1) {
   497    497   		/* No arguments given, just return the hostname */
   498    498   		chk_ret = gethostname(hostname, sizeof(hostname));
   499    499   		if (chk_ret != 0) {
................................................................................
   527    527   	}
   528    528   
   529    529   	Tcl_SetObjResult(interp, Tcl_NewStringObj("wrong # args: should be \"hostname ?hostname?\"", -1));
   530    530   
   531    531   	return(TCL_ERROR);
   532    532   }
   533    533   
   534         -static int tclsystem_domainname(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
          534  +static int tuapi_domainname(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
   535    535   	Tcl_SetObjResult(interp, Tcl_NewStringObj("not implemented", -1));
   536    536   
   537    537   	return(TCL_ERROR);
   538    538   }
   539    539   
   540         -static int tclsystem_chroot(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
          540  +static int tuapi_chroot(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
   541    541   	char *pathname;
   542    542   	int chk_ret;
   543    543   
   544    544   	if (objc != 2) {
   545         -		Tcl_SetObjResult(interp, Tcl_NewStringObj("wrong # args: should be \"::system::syscall:chroot pathname\"", -1));
          545  +		Tcl_SetObjResult(interp, Tcl_NewStringObj("wrong # args: should be \"::tuapi::syscall:chroot pathname\"", -1));
   546    546   
   547    547   		return(TCL_ERROR);
   548    548   	}
   549    549   
   550    550   	pathname = Tcl_GetString(objv[1]);
   551    551   
   552    552   	chk_ret = chroot(pathname);
................................................................................
   555    555   
   556    556   		return(TCL_ERROR);
   557    557   	}
   558    558   
   559    559   	return(TCL_OK);
   560    560   }
   561    561   
   562         -static int tclsystem_pivot_root(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
          562  +static int tuapi_pivot_root(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
   563    563   	char *new_root, *put_old;
   564    564   	int chk_ret;
   565    565   
   566    566   	if (objc != 3) {
   567         -		Tcl_SetObjResult(interp, Tcl_NewStringObj("wrong # args: should be \"::system::syscall::pivot_root new_root put_old\"", -1));
          567  +		Tcl_SetObjResult(interp, Tcl_NewStringObj("wrong # args: should be \"::tuapi::syscall::pivot_root new_root put_old\"", -1));
   568    568   
   569    569   		return(TCL_ERROR);
   570    570   	}
   571    571   
   572    572   	new_root = Tcl_GetString(objv[1]);
   573    573   	put_old = Tcl_GetString(objv[2]);
   574    574   
................................................................................
   578    578   
   579    579   		return(TCL_ERROR);
   580    580   	}
   581    581   
   582    582   	return(TCL_OK);
   583    583   }
   584    584   
   585         -static int tclsystem_mknod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
          585  +static int tuapi_mknod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
   586    586   	Tcl_SetObjResult(interp, Tcl_NewStringObj("not implemented", -1));
   587    587   
   588    588   	return(TCL_ERROR);
   589    589   }
   590    590   
   591         -static int tclsystem_getuid(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
          591  +static int tuapi_getuid(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
   592    592   	Tcl_SetObjResult(interp, Tcl_NewStringObj("not implemented", -1));
   593    593   
   594    594   	return(TCL_ERROR);
   595    595   }
   596    596   
   597         -static int tclsystem_kill(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
          597  +static int tuapi_kill(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
   598    598   	Tcl_Obj *signal_obj;
   599    599   
   600    600   	Tcl_WideInt pid_wide, sig_wide;
   601    601   	pid_t pid;
   602    602   	int sig;
   603    603   	int kill_ret, tcl_ret;
   604    604   
   605    605   	if (objc != 3) {
   606         -		Tcl_SetObjResult(interp, Tcl_NewStringObj("wrong # args: should be \"::system::syscall::kill pid sig\"", -1));
          606  +		Tcl_SetObjResult(interp, Tcl_NewStringObj("wrong # args: should be \"::tuapi::syscall::kill pid sig\"", -1));
   607    607   
   608    608   		return(TCL_ERROR);
   609    609   	}
   610    610   
   611    611   	tcl_ret = Tcl_GetWideIntFromObj(interp, objv[1], &pid_wide);
   612    612   	if (tcl_ret != TCL_OK) {
   613    613   		return(tcl_ret);
................................................................................
   614    614   	}
   615    615   	pid = pid_wide;
   616    616   
   617    617   	signal_obj = objv[2];
   618    618   
   619    619   	tcl_ret = Tcl_GetWideIntFromObj(interp, signal_obj, &sig_wide);
   620    620   	if (tcl_ret != TCL_OK) {
   621         -		switch (tclsystem_internal_simplehash_obj(signal_obj)) {
          621  +		switch (tuapi_internal_simplehash_obj(signal_obj)) {
   622    622   			case 0x122ad0: /* HUP */
   623    623   			case 0x98f364d0: /* SIGHUP */
   624    624   				sig = SIGHUP;
   625    625   				break;
   626    626   			case 0x126754: /* INT */
   627    627   			case 0x98f32954: /* SIGINT */
   628    628   				sig = SIGINT;
................................................................................
   762    762   
   763    763   		return(TCL_ERROR);
   764    764   	}
   765    765   
   766    766   	return(TCL_OK);
   767    767   }
   768    768   
   769         -static int tclsystem_ps(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
          769  +static int tuapi_ps(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
   770    770   	Tcl_SetObjResult(interp, Tcl_NewStringObj("not implemented", -1));
   771    771   
   772    772   	return(TCL_ERROR);
   773    773   }
   774    774   
   775         -static int tclsystem_execve(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
          775  +static int tuapi_execve(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
   776    776   	char **argv = NULL;
   777    777   	char *file;
   778    778   	int idx;
   779    779   
   780    780   	if (objc < 2) {
   781         -		Tcl_SetObjResult(interp, Tcl_NewStringObj("wrong # args: should be \"::system::syscall::execve file ?args ...?\"", -1));
          781  +		Tcl_SetObjResult(interp, Tcl_NewStringObj("wrong # args: should be \"::tuapi::syscall::execve file ?args ...?\"", -1));
   782    782   
   783    783   		return(TCL_ERROR);
   784    784   	}
   785    785   
   786    786   	/* Find executable */
   787    787   	file = Tcl_GetString(objv[1]);
   788    788   
................................................................................
   799    799   
   800    800   	/* If the new image could not take over, something went wrong -- report error */
   801    801   	Tcl_SetObjResult(interp, Tcl_NewStringObj(strerror(errno), -1));
   802    802   
   803    803   	return(TCL_ERROR);
   804    804   }
   805    805   
   806         -static int tclsystem_losetup(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
          806  +static int tuapi_losetup(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
   807    807   	char *file, *loopdev;
   808    808   	int chk_ret;
   809    809   	int loopfd, filefd;
   810    810   
   811    811   	if (objc != 3) {
   812         -		Tcl_SetObjResult(interp, Tcl_NewStringObj("wrong # args: should be \"::system::syscall::losetup loopdev file\"", -1));
          812  +		Tcl_SetObjResult(interp, Tcl_NewStringObj("wrong # args: should be \"::tuapi::syscall::losetup loopdev file\"", -1));
   813    813   
   814    814   		return(TCL_ERROR);
   815    815   	}
   816    816   
   817    817   	loopdev = Tcl_GetString(objv[1]);
   818    818   	file = Tcl_GetString(objv[2]);
   819    819   
................................................................................
   848    848   
   849    849   		return(TCL_ERROR);
   850    850   	}
   851    851   
   852    852   	return(TCL_OK);
   853    853   }
   854    854   
   855         -static void tclsystem_private_append_sockaddr_to_tclobj(Tcl_Interp *interp, Tcl_Obj *list, char *header, struct sockaddr *addr) {
          855  +static void tuapi_private_append_sockaddr_to_tclobj(Tcl_Interp *interp, Tcl_Obj *list, char *header, struct sockaddr *addr) {
   856    856   	char addr_buf[INET6_ADDRSTRLEN + INET_ADDRSTRLEN + 1], *chk_inp;
   857    857   
   858    858   	switch (addr->sa_family) {
   859    859   		case AF_INET: /* IPv4 */
   860    860   		case AF_INET6: /* IPv6 */
   861    861   			switch (addr->sa_family) {
   862    862   				case AF_INET: /* IPv4 */
................................................................................
   879    879   
   880    880   			break;
   881    881   	}
   882    882   
   883    883   	return;
   884    884   }
   885    885   
   886         -static int tclsystem_private_get_sockaddr_from_obj(Tcl_Obj *value, void *target) {
          886  +static int tuapi_private_get_sockaddr_from_obj(Tcl_Obj *value, void *target) {
   887    887   	struct sockaddr_in local_v4;
   888    888   	struct sockaddr_in6 local_v6;
   889    889   	const char *addr_str;
   890    890   	int inetpton_ret;
   891    891   
   892    892   	addr_str = Tcl_GetString(value);
   893    893   
................................................................................
   910    910   
   911    911   		return(0);
   912    912   	}
   913    913   
   914    914   	return(-1);
   915    915   }
   916    916   
   917         -static int tclsystem_ifconfig_list(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], int sock) {
          917  +static int tuapi_ifconfig_list(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], int sock) {
   918    918   	Tcl_Obj *tcl_iface_list;
   919    919   	struct ifconf ifaces_cfg;
   920    920   	struct ifreq *iface_req = NULL;
   921    921   	int iface_req_cnt = 224, iface_req_len;
   922    922   	int idx, iface_cnt;
   923    923   	int ioctl_ret, tcl_ret;
   924    924   
................................................................................
   960    960   	free(iface_req);
   961    961   
   962    962   	Tcl_SetObjResult(interp, tcl_iface_list);
   963    963   
   964    964   	return(TCL_OK);
   965    965   }
   966    966   
   967         -static int tclsystem_ifconfig_info(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], int sock, int sock_v4, int sock_v6) {
          967  +static int tuapi_ifconfig_info(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], int sock, int sock_v4, int sock_v6) {
   968    968   	Tcl_Obj *retlist, *flags;
   969    969   	struct ifreq iface_req;
   970    970   	unsigned char *addr_data;
   971    971   	const char *link_encap;
   972    972   	const char *iface;
   973    973   	int flags_bitmask, flag_broadcast = 0, flag_pointopoint = 0;
   974    974   	int ioctl_ret;
................................................................................
  1243   1243   		Tcl_ListObjAppendElement(interp, retlist, Tcl_NewStringObj("index", -1));
  1244   1244   		Tcl_ListObjAppendElement(interp, retlist, Tcl_NewWideIntObj(iface_req.ifr_ifindex));
  1245   1245   	}
  1246   1246   
  1247   1247   	if (sock_v4 != -1) {
  1248   1248   		ioctl_ret = ioctl(sock_v4, SIOCGIFADDR, &iface_req);
  1249   1249   		if (ioctl_ret == 0) {
  1250         -			tclsystem_private_append_sockaddr_to_tclobj(interp, retlist, "address", &iface_req.ifr_addr);
         1250  +			tuapi_private_append_sockaddr_to_tclobj(interp, retlist, "address", &iface_req.ifr_addr);
  1251   1251   		}
  1252   1252   
  1253   1253   		if (flag_pointopoint) {
  1254   1254   			/* Point-to-Point interfaces */
  1255   1255   			ioctl_ret = ioctl(sock_v4, SIOCGIFDSTADDR, &iface_req);
  1256   1256   			if (ioctl_ret == 0) {
  1257         -				tclsystem_private_append_sockaddr_to_tclobj(interp, retlist, "destination", &iface_req.ifr_addr);
         1257  +				tuapi_private_append_sockaddr_to_tclobj(interp, retlist, "destination", &iface_req.ifr_addr);
  1258   1258   			}
  1259   1259   		}
  1260   1260   
  1261   1261   		if (flag_broadcast) {
  1262   1262   			/* Broadcast interfaces */
  1263   1263   			ioctl_ret = ioctl(sock_v4, SIOCGIFBRDADDR, &iface_req);
  1264   1264   			if (ioctl_ret == 0) {
  1265         -				tclsystem_private_append_sockaddr_to_tclobj(interp, retlist, "broadcast", &iface_req.ifr_addr);
         1265  +				tuapi_private_append_sockaddr_to_tclobj(interp, retlist, "broadcast", &iface_req.ifr_addr);
  1266   1266   			}
  1267   1267   		}
  1268   1268   
  1269   1269   		ioctl_ret = ioctl(sock_v4, SIOCGIFNETMASK, &iface_req);
  1270   1270   		if (ioctl_ret == 0) {
  1271         -			tclsystem_private_append_sockaddr_to_tclobj(interp, retlist, "netmask", &iface_req.ifr_addr);
         1271  +			tuapi_private_append_sockaddr_to_tclobj(interp, retlist, "netmask", &iface_req.ifr_addr);
  1272   1272   		}
  1273   1273   	}
  1274   1274   
  1275   1275   	Tcl_SetObjResult(interp, retlist);
  1276   1276   
  1277   1277   	return(TCL_OK);
  1278   1278   }
  1279   1279   
  1280         -static int tclsystem_ifconfig_conf(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], int sock, int sock_v4, int sock_v6) {
         1280  +static int tuapi_ifconfig_conf(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], int sock, int sock_v4, int sock_v6) {
  1281   1281   	Tcl_Obj *option_name_obj, *option_val_obj;
  1282   1282   	Tcl_Obj **flags_objv;
  1283   1283   	struct ifreq iface_req;
  1284   1284   	struct sockaddr *tmp_ioctl_addr;
  1285   1285   	const char *iface;
  1286   1286   	short flags;
  1287   1287   	int flags_objc;
................................................................................
  1313   1313   		}
  1314   1314   
  1315   1315   		objc--;
  1316   1316   		objv++;
  1317   1317   
  1318   1318   		option_val_obj = objv[0];
  1319   1319   
  1320         -		switch (tclsystem_internal_simplehash_obj(option_name_obj)) {
         1320  +		switch (tuapi_internal_simplehash_obj(option_name_obj)) {
  1321   1321   			case 0x6d9870f3: /* flags */
  1322   1322   				flags = 0;
  1323   1323   
  1324   1324   				tcl_ret = Tcl_ListObjGetElements(interp, option_val_obj, &flags_objc, &flags_objv);
  1325   1325   				if (tcl_ret != TCL_OK) {
  1326   1326   					return(tcl_ret);
  1327   1327   				}
  1328   1328   
  1329   1329   				for (; flags_objc > 0; flags_objc--,flags_objv++) {
  1330         -					switch (tclsystem_internal_simplehash_obj(flags_objv[0])) {
         1330  +					switch (tuapi_internal_simplehash_obj(flags_objv[0])) {
  1331   1331   						case 0x2ad0: /* UP */
  1332   1332   							flags |= IFF_UP;
  1333   1333   							break;
  1334   1334   						case 0x1aef7f54: /* BROADCAST */
  1335   1335   							flags |= IFF_BROADCAST;
  1336   1336   							break;
  1337   1337   						case 0xc252abd4: /* POINTOPOINT */
................................................................................
  1427   1427   
  1428   1428   			case 0x4d65ee6b: /* netmask */
  1429   1429   				if (tmp_ioctl == -1) {
  1430   1430   					tmp_ioctl = SIOCSIFNETMASK;
  1431   1431   					tmp_ioctl_addr = &iface_req.ifr_netmask;
  1432   1432   				}
  1433   1433   
  1434         -				parse_ret = tclsystem_private_get_sockaddr_from_obj(option_val_obj, tmp_ioctl_addr);
         1434  +				parse_ret = tuapi_private_get_sockaddr_from_obj(option_val_obj, tmp_ioctl_addr);
  1435   1435   				if (parse_ret != 0) {
  1436   1436   					Tcl_SetObjResult(interp, Tcl_ObjPrintf("unable to parse \"%s\" as an address", Tcl_GetString(option_val_obj)));
  1437   1437   
  1438   1438   					return(TCL_ERROR);
  1439   1439   				}
  1440   1440   
  1441   1441   				switch (tmp_ioctl_addr->sa_family) {
................................................................................
  1466   1466   				return(TCL_ERROR);
  1467   1467   		}
  1468   1468   	}
  1469   1469   
  1470   1470   	return(TCL_OK);
  1471   1471   }
  1472   1472   
  1473         -static int tclsystem_ifconfig(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
         1473  +static int tuapi_ifconfig(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
  1474   1474   	int sock_v4, sock_v6, sock;
  1475   1475   	int retval = TCL_ERROR;
  1476   1476   
  1477         -	sock = tclsystem_internal_getsock(&sock_v4, &sock_v6);
         1477  +	sock = tuapi_internal_getsock(&sock_v4, &sock_v6);
  1478   1478   	if (sock == -1) {
  1479   1479   		Tcl_SetObjResult(interp, Tcl_NewStringObj("unable to create socket", -1));
  1480   1480   
  1481   1481   		return(TCL_ERROR);
  1482   1482   	}
  1483   1483   
  1484   1484   	switch (objc) {
  1485   1485   		case 0:
  1486   1486   		case 1: /* No arguments, list all interfaces */
  1487         -			retval = tclsystem_ifconfig_list(cd, interp, objc, objv, sock);
         1487  +			retval = tuapi_ifconfig_list(cd, interp, objc, objv, sock);
  1488   1488   
  1489   1489   			break;
  1490   1490   		case 2: /* One argument, give information about the interface */
  1491         -			retval = tclsystem_ifconfig_info(cd, interp, objc, objv, sock, sock_v4, sock_v6);
         1491  +			retval = tuapi_ifconfig_info(cd, interp, objc, objv, sock, sock_v4, sock_v6);
  1492   1492   
  1493   1493   			break;
  1494   1494   		default:
  1495   1495   			/* Otherwise, configure the interace */
  1496         -			retval = tclsystem_ifconfig_conf(cd, interp, objc, objv, sock, sock_v4, sock_v6);
         1496  +			retval = tuapi_ifconfig_conf(cd, interp, objc, objv, sock, sock_v4, sock_v6);
  1497   1497   
  1498   1498   			break;
  1499   1499   	}
  1500   1500   
  1501   1501   	/* Cleanup */
  1502   1502   	if (sock_v4 != -1) {
  1503   1503   		close(sock_v4);
................................................................................
  1506   1506   	if (sock_v6 != -1) {
  1507   1507   		close(sock_v6);
  1508   1508   	}
  1509   1509   
  1510   1510   	return(retval);
  1511   1511   }
  1512   1512   
  1513         -static int tclsystem_route_list(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], int sock_v4, int sock_v6) {
         1513  +static int tuapi_route_list(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], int sock_v4, int sock_v6) {
  1514   1514   	Tcl_SetObjResult(interp, Tcl_NewStringObj("not implemented", -1));
  1515   1515   
  1516   1516   	return(TCL_ERROR);
  1517   1517   }
  1518   1518   
  1519         -static int tclsystem_route_conf(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], int sock_v4, int sock_v6) {
         1519  +static int tuapi_route_conf(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], int sock_v4, int sock_v6) {
  1520   1520   	Tcl_WideInt option_val_wide; 
  1521   1521   	Tcl_Obj *operation_obj, *dest_obj, *destmask_obj;
  1522   1522   	Tcl_Obj *option_name_obj, *option_val_obj;
  1523   1523   	struct rtentry route;
  1524   1524   	int sock;
  1525   1525   	int ioctl_id;
  1526   1526   	int tcl_ret, ioctl_ret, parse_ret;
  1527   1527   
  1528   1528   	if (objc < 4) {
  1529         -		Tcl_SetObjResult(interp, Tcl_NewStringObj("wrong # args: should be \"::system::syscall::route operation destination destination_mask ?options?\"", -1));
         1529  +		Tcl_SetObjResult(interp, Tcl_NewStringObj("wrong # args: should be \"::tuapi::syscall::route operation destination destination_mask ?options?\"", -1));
  1530   1530   
  1531   1531   		return(TCL_ERROR);
  1532   1532   	}
  1533   1533   
  1534   1534   	/* Clear object values */
  1535   1535   	memset(&route, 0, sizeof(route));
  1536   1536   
  1537   1537   	/* Determine operation */
  1538   1538   	operation_obj = objv[1];
  1539         -	switch (tclsystem_internal_simplehash_obj(operation_obj)) {
         1539  +	switch (tuapi_internal_simplehash_obj(operation_obj)) {
  1540   1540   		case 0x187264: /* add */
  1541   1541   			ioctl_id = SIOCADDRT;
  1542   1542   			break;
  1543   1543   		case 0x1932ec: /* del */
  1544   1544   		case 0x5d98e965: /* delete */
  1545   1545   			ioctl_id = SIOCDELRT;
  1546   1546   			break;
................................................................................
  1551   1551   	}
  1552   1552   
  1553   1553   	/* Set default flags */
  1554   1554   	route.rt_flags = RTF_UP;
  1555   1555   
  1556   1556   	/* Parse destination address */
  1557   1557   	dest_obj = objv[2];
  1558         -	parse_ret = tclsystem_private_get_sockaddr_from_obj(dest_obj, &route.rt_dst);
         1558  +	parse_ret = tuapi_private_get_sockaddr_from_obj(dest_obj, &route.rt_dst);
  1559   1559   	if (parse_ret != 0) {
  1560   1560   		Tcl_SetObjResult(interp, Tcl_ObjPrintf("unable to parse \"%s\" as an address", Tcl_GetString(dest_obj)));
  1561   1561   
  1562   1562   		return(TCL_ERROR);
  1563   1563   	}
  1564   1564   
  1565   1565   	/* Parse destination netmask */
  1566   1566   	destmask_obj = objv[3];
  1567         -	parse_ret = tclsystem_private_get_sockaddr_from_obj(destmask_obj, &route.rt_genmask);
         1567  +	parse_ret = tuapi_private_get_sockaddr_from_obj(destmask_obj, &route.rt_genmask);
  1568   1568   	if (parse_ret != 0) {
  1569   1569   		Tcl_SetObjResult(interp, Tcl_ObjPrintf("unable to parse \"%s\" as an address", Tcl_GetString(destmask_obj)));
  1570   1570   
  1571   1571   		return(TCL_ERROR);
  1572   1572   	}
  1573   1573   
  1574   1574   	if (route.rt_dst.sa_family != route.rt_genmask.sa_family) {
................................................................................
  1627   1627   		}
  1628   1628   
  1629   1629   		objc--;
  1630   1630   		objv++;
  1631   1631   
  1632   1632   		option_val_obj = objv[0];
  1633   1633   
  1634         -		switch (tclsystem_internal_simplehash_obj(option_name_obj)) {
         1634  +		switch (tuapi_internal_simplehash_obj(option_name_obj)) {
  1635   1635   			case 0x4c727779: /* gateway */
  1636         -				parse_ret = tclsystem_private_get_sockaddr_from_obj(option_val_obj, &route.rt_gateway);
         1636  +				parse_ret = tuapi_private_get_sockaddr_from_obj(option_val_obj, &route.rt_gateway);
  1637   1637   				if (parse_ret != 0) {
  1638   1638   					Tcl_SetObjResult(interp, Tcl_ObjPrintf("unable to parse \"%s\" as an address", Tcl_GetString(option_val_obj)));
  1639   1639   
  1640   1640   					return(TCL_ERROR);
  1641   1641   				}
  1642   1642   
  1643   1643   				route.rt_flags &= (~RTF_HOST);
................................................................................
  1692   1692   
  1693   1693   		return(TCL_ERROR);
  1694   1694   	}
  1695   1695   
  1696   1696   	return(TCL_OK);
  1697   1697   }
  1698   1698   
  1699         -static int tclsystem_route(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
         1699  +static int tuapi_route(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
  1700   1700   	int sock_v4, sock_v6, sock;
  1701   1701   	int retval = TCL_ERROR;
  1702   1702   
  1703         -	sock = tclsystem_internal_getsock(&sock_v4, &sock_v6);
         1703  +	sock = tuapi_internal_getsock(&sock_v4, &sock_v6);
  1704   1704   	if (sock == -1) {
  1705   1705   		Tcl_SetObjResult(interp, Tcl_NewStringObj("unable to create socket", -1));
  1706   1706   
  1707   1707   		return(TCL_ERROR);
  1708   1708   	}
  1709   1709   
  1710   1710   	switch (objc) {
  1711   1711   		case 0:
  1712   1712   		case 1: /* No arguments, list all interfaces */
  1713         -			retval = tclsystem_route_list(cd, interp, objc, objv, sock_v4, sock_v6);
         1713  +			retval = tuapi_route_list(cd, interp, objc, objv, sock_v4, sock_v6);
  1714   1714   
  1715   1715   			break;
  1716   1716   		default:
  1717   1717   			/* Otherwise, modify routes */
  1718         -			retval = tclsystem_route_conf(cd, interp, objc, objv, sock_v4, sock_v6);
         1718  +			retval = tuapi_route_conf(cd, interp, objc, objv, sock_v4, sock_v6);
  1719   1719   
  1720   1720   			break;
  1721   1721   	}
  1722   1722   
  1723   1723   	/* Cleanup */
  1724   1724   	if (sock_v4 != -1) {
  1725   1725   		close(sock_v4);
................................................................................
  1728   1728   	if (sock_v6 != -1) {
  1729   1729   		close(sock_v6);
  1730   1730   	}
  1731   1731   
  1732   1732   	return(retval);
  1733   1733   }
  1734   1734   
  1735         -static int tclsystem_brctl_list(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], int sock) {
         1735  +static int tuapi_brctl_list(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], int sock) {
  1736   1736   	Tcl_SetObjResult(interp, Tcl_NewStringObj("not implemented", -1));
  1737   1737   
  1738   1738   	return(TCL_ERROR);
  1739   1739   }
  1740   1740   
  1741         -static int tclsystem_brctl_conf(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], int sock) {
         1741  +static int tuapi_brctl_conf(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], int sock) {
  1742   1742   	Tcl_Obj *operation_obj, *bridge_name_obj, *interface_name_obj;
  1743   1743   	unsigned long arg[4];
  1744   1744   	struct ifreq ifr;
  1745   1745   	int ioctl_ret, ioctl_id;
  1746   1746   	int add = 0;
  1747   1747   
  1748   1748   	/* Determine operation */
  1749   1749   	operation_obj = objv[1];
  1750         -	switch (tclsystem_internal_simplehash_obj(operation_obj)) {
         1750  +	switch (tuapi_internal_simplehash_obj(operation_obj)) {
  1751   1751   		case 0x1c993272: /* addbr */
  1752   1752   			add = 1;
  1753   1753   		case 0x4cbb3272: /* delbr */
  1754   1754   			if (objc != 3) {
  1755   1755   				if (add) {
  1756         -					Tcl_SetObjResult(interp, Tcl_NewStringObj("wrong # args: should be \"::system::syscall::brctl addbr bridge\"", -1));
         1756  +					Tcl_SetObjResult(interp, Tcl_NewStringObj("wrong # args: should be \"::tuapi::syscall::brctl addbr bridge\"", -1));
  1757   1757   				} else {
  1758         -					Tcl_SetObjResult(interp, Tcl_NewStringObj("wrong # args: should be \"::system::syscall::brctl delbr bridge\"", -1));
         1758  +					Tcl_SetObjResult(interp, Tcl_NewStringObj("wrong # args: should be \"::tuapi::syscall::brctl delbr bridge\"", -1));
  1759   1759   				}
  1760   1760   
  1761   1761   				return(TCL_ERROR);
  1762   1762   			}
  1763   1763   
  1764   1764   			bridge_name_obj = objv[2];
  1765   1765   
................................................................................
  1776   1776   
  1777   1777   			break;
  1778   1778   		case 0x1C9937E6: /* addif */
  1779   1779   			add = 1;
  1780   1780   		case 0x4cbb37e6: /* delif */
  1781   1781   			if (objc != 4) {
  1782   1782   				if (add) {
  1783         -					Tcl_SetObjResult(interp, Tcl_NewStringObj("wrong # args: should be \"::system::syscall::brctl addif bridge interface\"", -1));
         1783  +					Tcl_SetObjResult(interp, Tcl_NewStringObj("wrong # args: should be \"::tuapi::syscall::brctl addif bridge interface\"", -1));
  1784   1784   				} else {
  1785         -					Tcl_SetObjResult(interp, Tcl_NewStringObj("wrong # args: should be \"::system::syscall::brctl delif bridge interface\"", -1));
         1785  +					Tcl_SetObjResult(interp, Tcl_NewStringObj("wrong # args: should be \"::tuapi::syscall::brctl delif bridge interface\"", -1));
  1786   1786   				}
  1787   1787   
  1788   1788   				return(TCL_ERROR);
  1789   1789   			}
  1790   1790   
  1791   1791   			if (add) {
  1792   1792   				ioctl_id = SIOCBRADDIF;
................................................................................
  1814   1814   
  1815   1815   		return(TCL_ERROR);
  1816   1816   	}
  1817   1817   
  1818   1818   	return(TCL_OK);
  1819   1819   }
  1820   1820   
  1821         -static int tclsystem_brctl(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
         1821  +static int tuapi_brctl(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
  1822   1822   	int sock_v4, sock_v6, sock;
  1823   1823   	int retval = TCL_ERROR;
  1824   1824   
  1825         -	sock = tclsystem_internal_getsock(&sock_v4, &sock_v6);
         1825  +	sock = tuapi_internal_getsock(&sock_v4, &sock_v6);
  1826   1826   	if (sock == -1) {
  1827   1827   		Tcl_SetObjResult(interp, Tcl_NewStringObj("unable to create socket", -1));
  1828   1828   
  1829   1829   		return(TCL_ERROR);
  1830   1830   	}
  1831   1831   
  1832   1832   	switch (objc) {
  1833   1833   		case 0:
  1834   1834   		case 1: /* No arguments, list all bridges */
  1835         -			retval = tclsystem_brctl_list(cd, interp, objc, objv, sock);
         1835  +			retval = tuapi_brctl_list(cd, interp, objc, objv, sock);
  1836   1836   
  1837   1837   			break;
  1838   1838   		default:
  1839   1839   			/* Otherwise, modify routes */
  1840         -			retval = tclsystem_brctl_conf(cd, interp, objc, objv, sock);
         1840  +			retval = tuapi_brctl_conf(cd, interp, objc, objv, sock);
  1841   1841   
  1842   1842   			break;
  1843   1843   	}
  1844   1844   
  1845   1845   	/* Cleanup */
  1846   1846   	if (sock_v4 != -1) {
  1847   1847   		close(sock_v4);
................................................................................
  1850   1850   	if (sock_v6 != -1) {
  1851   1851   		close(sock_v6);
  1852   1852   	}
  1853   1853   
  1854   1854   	return(retval);
  1855   1855   }
  1856   1856   
  1857         -static int tclsystem_vconfig(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
         1857  +static int tuapi_vconfig(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
  1858   1858   	int sock_v4, sock_v6, sock;
  1859   1859   	int retval = TCL_ERROR;
  1860   1860   
  1861         -	sock = tclsystem_internal_getsock(&sock_v4, &sock_v6);
         1861  +	sock = tuapi_internal_getsock(&sock_v4, &sock_v6);
  1862   1862   	if (sock == -1) {
  1863   1863   		Tcl_SetObjResult(interp, Tcl_NewStringObj("unable to create socket", -1));
  1864   1864   
  1865   1865   		return(TCL_ERROR);
  1866   1866   	}
  1867   1867   
  1868   1868   	Tcl_SetObjResult(interp, Tcl_NewStringObj("not implemented", -1));
................................................................................
  1876   1876   		close(sock_v6);
  1877   1877   	}
  1878   1878   
  1879   1879   	return(retval);
  1880   1880   }
  1881   1881   
  1882   1882   #ifndef DISABLE_UNIX_SOCKETS
  1883         -struct tclsystem_socket_unix__chan_id {
         1883  +struct tuapi_socket_unix__chan_id {
  1884   1884   	int fd;
  1885   1885   	Tcl_Channel chan;
  1886   1886   };
  1887   1887   
  1888         -static int tclsystem_socket_unix__chan_close(ClientData id_p, Tcl_Interp *interp) {
  1889         -	struct tclsystem_socket_unix__chan_id *id;
         1888  +static int tuapi_socket_unix__chan_close(ClientData id_p, Tcl_Interp *interp) {
         1889  +	struct tuapi_socket_unix__chan_id *id;
  1890   1890   	int fd;
  1891   1891   
  1892   1892   	id = id_p;
  1893   1893   
  1894   1894   	fd = id->fd;
  1895   1895   
  1896   1896   	close(fd);
  1897   1897   
  1898   1898   	free(id);
  1899   1899   
  1900   1900   	return(0);
  1901   1901   }
  1902   1902   
  1903         -static int tclsystem_socket_unix__chan_read(ClientData id_p, char *buf, int bufsize, int *errorCodePtr) {
  1904         -	struct tclsystem_socket_unix__chan_id *id;
         1903  +static int tuapi_socket_unix__chan_read(ClientData id_p, char *buf, int bufsize, int *errorCodePtr) {
         1904  +	struct tuapi_socket_unix__chan_id *id;
  1905   1905   	ssize_t read_ret;
  1906   1906   	int fd;
  1907   1907   	int retval;
  1908   1908   
  1909   1909   	id = id_p;
  1910   1910   
  1911   1911   	fd = id->fd;
................................................................................
  1918   1918   	}
  1919   1919   
  1920   1920   	retval = read_ret;
  1921   1921   
  1922   1922   	return(retval);
  1923   1923   }
  1924   1924   
  1925         -static int tclsystem_socket_unix__chan_write(ClientData id_p, const char *buf, int toWrite, int *errorCodePtr) {
  1926         -	struct tclsystem_socket_unix__chan_id *id;
         1925  +static int tuapi_socket_unix__chan_write(ClientData id_p, const char *buf, int toWrite, int *errorCodePtr) {
         1926  +	struct tuapi_socket_unix__chan_id *id;
  1927   1927   	ssize_t write_ret;
  1928   1928   	int fd;
  1929   1929   	int bytesWritten;
  1930   1930   
  1931   1931   	id = id_p;
  1932   1932   
  1933   1933   	fd = id->fd;
................................................................................
  1955   1955   
  1956   1956   		return(-1);
  1957   1957   	}
  1958   1958   
  1959   1959   	return(bytesWritten);
  1960   1960   }
  1961   1961   
  1962         -static void tclsystem_socket_unix__chan_eventhandler(ClientData id_p, int mask) {
  1963         -	struct tclsystem_socket_unix__chan_id *id;
         1962  +static void tuapi_socket_unix__chan_eventhandler(ClientData id_p, int mask) {
         1963  +	struct tuapi_socket_unix__chan_id *id;
  1964   1964   	Tcl_Channel chan;
  1965   1965   
  1966   1966   	id = id_p;
  1967   1967   
  1968   1968   	chan = id->chan;
  1969   1969   
  1970   1970   	if (!chan) {
  1971   1971   		return;
  1972   1972   	}
  1973   1973   
  1974   1974   	Tcl_NotifyChannel(chan, mask);
  1975   1975   }
  1976   1976   
  1977         -static void tclsystem_socket_unix__chan_watch(ClientData id_p, int mask) {
  1978         -	struct tclsystem_socket_unix__chan_id *id;
         1977  +static void tuapi_socket_unix__chan_watch(ClientData id_p, int mask) {
         1978  +	struct tuapi_socket_unix__chan_id *id;
  1979   1979   	int fd;
  1980   1980   
  1981   1981   	id = id_p;
  1982   1982   
  1983   1983   	fd = id->fd;
  1984   1984   
  1985         -	Tcl_CreateFileHandler(fd, mask, tclsystem_socket_unix__chan_eventhandler, id);
         1985  +	Tcl_CreateFileHandler(fd, mask, tuapi_socket_unix__chan_eventhandler, id);
  1986   1986   
  1987   1987   	return;
  1988   1988   }
  1989   1989   
  1990         -static int tclsystem_socket_unix__chan_gethandle(ClientData id_p, int direction, ClientData *handlePtr) {
  1991         -	struct tclsystem_socket_unix__chan_id *id;
         1990  +static int tuapi_socket_unix__chan_gethandle(ClientData id_p, int direction, ClientData *handlePtr) {
         1991  +	struct tuapi_socket_unix__chan_id *id;
  1992   1992   	int fd;
  1993   1993   	ClientData fd_cd;
  1994   1994   
  1995   1995   	id = id_p;
  1996   1996   
  1997   1997   	fd = id->fd;
  1998   1998   
................................................................................
  1999   1999   	memcpy(&fd_cd, &fd, sizeof(fd));
  2000   2000   
  2001   2001   	*handlePtr = fd_cd;
  2002   2002   
  2003   2003   	return(TCL_OK);
  2004   2004   }
  2005   2005   
  2006         -static Tcl_Channel tclsystem_socket_unix_sock2tclchan(int sock) {
  2007         -	struct tclsystem_socket_unix__chan_id *id;
         2006  +static Tcl_Channel tuapi_socket_unix_sock2tclchan(int sock) {
         2007  +	struct tuapi_socket_unix__chan_id *id;
  2008   2008   	static Tcl_ChannelType tcl_chan_type;
  2009   2009   	static int tcl_chan_type_init = 0;
  2010   2010   	Tcl_Channel tcl_chan;
  2011   2011   	char chan_name[32];
  2012   2012   	int sock_flags;
  2013   2013   
  2014   2014   	if (!tcl_chan_type_init) {
  2015   2015   		tcl_chan_type.typeName = "socket";
  2016   2016   		tcl_chan_type.version = TCL_CHANNEL_VERSION_2;
  2017         -		tcl_chan_type.closeProc = tclsystem_socket_unix__chan_close;
  2018         -		tcl_chan_type.inputProc = tclsystem_socket_unix__chan_read;
  2019         -		tcl_chan_type.outputProc = tclsystem_socket_unix__chan_write;
  2020         -		tcl_chan_type.watchProc = tclsystem_socket_unix__chan_watch;
  2021         -		tcl_chan_type.getHandleProc = tclsystem_socket_unix__chan_gethandle;
         2017  +		tcl_chan_type.closeProc = tuapi_socket_unix__chan_close;
         2018  +		tcl_chan_type.inputProc = tuapi_socket_unix__chan_read;
         2019  +		tcl_chan_type.outputProc = tuapi_socket_unix__chan_write;
         2020  +		tcl_chan_type.watchProc = tuapi_socket_unix__chan_watch;
         2021  +		tcl_chan_type.getHandleProc = tuapi_socket_unix__chan_gethandle;
  2022   2022   		tcl_chan_type.seekProc = NULL;
  2023   2023   		tcl_chan_type.setOptionProc = NULL;
  2024   2024   		tcl_chan_type.getOptionProc = NULL;
  2025   2025   		tcl_chan_type.close2Proc = NULL;
  2026   2026   		tcl_chan_type.blockModeProc = NULL;
  2027   2027   		tcl_chan_type.flushProc = NULL;
  2028   2028   		tcl_chan_type.handlerProc = NULL;
................................................................................
  2057   2057   
  2058   2058   	/* Update the structure passed to each function to include the channel name */
  2059   2059   	id->chan = tcl_chan;
  2060   2060   
  2061   2061   	return(tcl_chan);
  2062   2062   }
  2063   2063   
  2064         -struct tclsystem_socket_unix__chan_accept_cd {
         2064  +struct tuapi_socket_unix__chan_accept_cd {
  2065   2065   	int fd;
  2066   2066   	Tcl_Interp *interp;
  2067   2067   	Tcl_Obj *command;
  2068   2068   };
  2069   2069   
  2070         -static void tclsystem_socket_unix__chan_accept(ClientData cd_p, int mask) {
  2071         -	struct tclsystem_socket_unix__chan_accept_cd *cd;
         2070  +static void tuapi_socket_unix__chan_accept(ClientData cd_p, int mask) {
         2071  +	struct tuapi_socket_unix__chan_accept_cd *cd;
  2072   2072   	Tcl_Interp *interp;
  2073   2073   	Tcl_Channel chan;
  2074   2074   	Tcl_Obj *command, *command_to_run_objs[5], *command_to_run;
  2075   2075   	int setsockopt_ret;
  2076   2076   	int pass_creds_true = 1;
  2077   2077   	int fd;
  2078   2078   	int sock;
................................................................................
  2088   2088   	command = cd->command;
  2089   2089   
  2090   2090   	sock = accept(fd, NULL, NULL);
  2091   2091   	if (sock < 0) {
  2092   2092   		return;
  2093   2093   	}
  2094   2094   
  2095         -	chan = tclsystem_socket_unix_sock2tclchan(sock);
         2095  +	chan = tuapi_socket_unix_sock2tclchan(sock);
  2096   2096   	if (chan == NULL) {
  2097   2097   		close(sock);
  2098   2098   
  2099   2099   		return;
  2100   2100   	}
  2101   2101   
  2102   2102   	setsockopt_ret = setsockopt(sock, SOL_SOCKET, SO_PASSCRED, &pass_creds_true, sizeof(pass_creds_true));
................................................................................
  2116   2116   	command_to_run = Tcl_ConcatObj(sizeof(command_to_run_objs) / sizeof(command_to_run_objs[0]), command_to_run_objs);
  2117   2117   
  2118   2118   	Tcl_EvalObjEx(interp, command_to_run, TCL_EVAL_GLOBAL);
  2119   2119   
  2120   2120   	return;
  2121   2121   }
  2122   2122   
  2123         -static int tclsystem_socket_unix_server(ClientData cd, Tcl_Interp *interp, int sock, const char *path, Tcl_Obj *command) {
  2124         -	struct tclsystem_socket_unix__chan_accept_cd *accept_cd;
         2123  +static int tuapi_socket_unix_server(ClientData cd, Tcl_Interp *interp, int sock, const char *path, Tcl_Obj *command) {
         2124  +	struct tuapi_socket_unix__chan_accept_cd *accept_cd;
  2125   2125   	struct sockaddr_un dest;
  2126   2126   	ssize_t pathlen;
  2127   2127   	int bind_ret, listen_ret;
  2128   2128   
  2129   2129   	pathlen = strlen(path) + 1;
  2130   2130   	if (pathlen <= 0) {
  2131   2131   		Tcl_SetObjResult(interp, Tcl_NewStringObj("path too short", -1));
................................................................................
  2165   2165   
  2166   2166   	accept_cd->fd = sock;
  2167   2167   	accept_cd->interp = interp;
  2168   2168   	accept_cd->command = command;
  2169   2169   
  2170   2170   	Tcl_IncrRefCount(command);
  2171   2171   
  2172         -	Tcl_CreateFileHandler(sock, TCL_READABLE, tclsystem_socket_unix__chan_accept, accept_cd);
         2172  +	Tcl_CreateFileHandler(sock, TCL_READABLE, tuapi_socket_unix__chan_accept, accept_cd);
  2173   2173   
  2174   2174   	return(TCL_OK);
  2175   2175   }
  2176   2176   
  2177         -static int tclsystem_socket_unix_client(ClientData cd, Tcl_Interp *interp, int sock, const char *path) {
         2177  +static int tuapi_socket_unix_client(ClientData cd, Tcl_Interp *interp, int sock, const char *path) {
  2178   2178   	Tcl_Channel chan;
  2179   2179   	struct sockaddr_un dest;
  2180   2180   	ssize_t pathlen;
  2181   2181   	int connect_ret, setsockopt_ret;
  2182   2182   	int pass_creds_true = 1;
  2183   2183   
  2184   2184   	pathlen = strlen(path) + 1;
................................................................................
  2207   2207   	setsockopt_ret = setsockopt(sock, SOL_SOCKET, SO_PASSCRED, &pass_creds_true, sizeof(pass_creds_true));
  2208   2208   	if (setsockopt_ret != 0) {
  2209   2209   		Tcl_SetObjResult(interp, Tcl_NewStringObj(strerror(errno), -1));
  2210   2210   
  2211   2211   		return(TCL_ERROR);
  2212   2212   	}
  2213   2213   
  2214         -	chan = tclsystem_socket_unix_sock2tclchan(sock);
         2214  +	chan = tuapi_socket_unix_sock2tclchan(sock);
  2215   2215   	if (chan == NULL) {
  2216   2216   		Tcl_SetObjResult(interp, Tcl_NewStringObj("unable to create Tcl channel", -1));
  2217   2217   
  2218   2218   		return(TCL_ERROR);
  2219   2219   	}
  2220   2220   
  2221   2221   	Tcl_RegisterChannel(interp, chan);
  2222   2222   
  2223   2223   	Tcl_SetObjResult(interp, Tcl_NewStringObj(Tcl_GetChannelName(chan), -1));
  2224   2224   
  2225   2225   	return(TCL_OK);
  2226   2226   }
  2227   2227   
  2228         -static int tclsystem_socket_unix(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
         2228  +static int tuapi_socket_unix(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
  2229   2229   	Tcl_Obj *path_obj, *command_obj;
  2230   2230   	char *path;
  2231   2231   	int retval;
  2232   2232   	int sock;
  2233   2233   
  2234   2234   	if (objc < 2) {
  2235         -		Tcl_SetObjResult(interp, Tcl_NewStringObj("wrong # args: should be \"::system::syscall::socket_unix path\" or \"::system::syscall::socket_unix -server command path\"", -1));
         2235  +		Tcl_SetObjResult(interp, Tcl_NewStringObj("wrong # args: should be \"::tuapi::syscall::socket_unix path\" or \"::tuapi::syscall::socket_unix -server command path\"", -1));
  2236   2236   
  2237   2237   		return(TCL_ERROR);
  2238   2238   	}
  2239   2239   
  2240   2240   	path_obj = objv[1];
  2241   2241   	path = Tcl_GetString(path_obj);
  2242   2242   
................................................................................
  2245   2245   		Tcl_SetObjResult(interp, Tcl_NewStringObj(strerror(errno), -1));
  2246   2246   
  2247   2247   		return(TCL_ERROR);
  2248   2248   	}
  2249   2249   
  2250   2250   	if (strcmp(path, "-server") == 0) {
  2251   2251   		if (objc != 4) {
  2252         -			Tcl_SetObjResult(interp, Tcl_NewStringObj("wrong # args: should be \"::system::syscall::socket_unix -server command path\"", -1));
         2252  +			Tcl_SetObjResult(interp, Tcl_NewStringObj("wrong # args: should be \"::tuapi::syscall::socket_unix -server command path\"", -1));
  2253   2253   
  2254   2254   			close(sock);
  2255   2255   
  2256   2256   			return(TCL_ERROR);
  2257   2257   		}
  2258   2258   
  2259   2259   		command_obj = objv[2];
  2260   2260   		path_obj = objv[3];
  2261   2261   
  2262   2262   		path = Tcl_GetString(path_obj);
  2263   2263   
  2264         -		retval = tclsystem_socket_unix_server(cd, interp, sock, path, command_obj);
         2264  +		retval = tuapi_socket_unix_server(cd, interp, sock, path, command_obj);
  2265   2265   	} else {
  2266   2266   		if (objc != 2) {
  2267         -			Tcl_SetObjResult(interp, Tcl_NewStringObj("wrong # args: should be \"::system::syscall::socket_unix path\"", -1));
         2267  +			Tcl_SetObjResult(interp, Tcl_NewStringObj("wrong # args: should be \"::tuapi::syscall::socket_unix path\"", -1));
  2268   2268   
  2269   2269   			close(sock);
  2270   2270   
  2271   2271   			return(TCL_ERROR);
  2272   2272   		}
  2273   2273   
  2274         -		retval = tclsystem_socket_unix_client(cd, interp, sock, path);
         2274  +		retval = tuapi_socket_unix_client(cd, interp, sock, path);
  2275   2275   	}
  2276   2276   
  2277   2277   	if (retval != TCL_OK) {
  2278   2278   		close(sock);
  2279   2279   	}
  2280   2280   
  2281   2281   	return(retval);
  2282   2282   }
  2283   2283   #else
  2284         -static int tclsystem_socket_unix(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
         2284  +static int tuapi_socket_unix(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
  2285   2285   	Tcl_SetObjResult(interp, Tcl_NewStringObj("not implemented", -1));
  2286   2286   	return(TCL_ERROR)
  2287   2287   }
  2288   2288   #endif
  2289   2289   
  2290         -static int tclsystem_tsmf_start_svc(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
         2290  +static int tuapi_tsmf_start_svc(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
  2291   2291   	struct timeval select_timeout;
  2292   2292   	Tcl_WideInt umask_val, timeout_val, uid_val, gid_val;
  2293   2293   	Tcl_Obj *filename_obj, *env_obj, *logfile_obj, **env_entry_objv, *cwd_obj, *umask_obj, *uid_obj, *gid_obj;
  2294   2294   	Tcl_Obj *sri_obj, *timeout_obj;
  2295   2295   	pid_t child, child_pgid = -1, waitpid_ret;
  2296   2296   	ssize_t read_ret;
  2297   2297   	time_t currtime;
................................................................................
  2305   2305   	int fds[2], fd;
  2306   2306   	int status;
  2307   2307   	int idx;
  2308   2308   
  2309   2309   	/* 1. Parse arguments */
  2310   2310   	/* 1.a. Ensure the correct number of arguments were passed */
  2311   2311   	if (objc != 10) {
  2312         -		Tcl_SetObjResult(interp, Tcl_NewStringObj("wrong # args: should be \"::system::syscall::tsmf_start_svc sri filename logfile env cwd umask uid gid timeout\"", -1));
         2312  +		Tcl_SetObjResult(interp, Tcl_NewStringObj("wrong # args: should be \"::tuapi::syscall::tsmf_start_svc sri filename logfile env cwd umask uid gid timeout\"", -1));
  2313   2313   
  2314   2314   		return(TCL_ERROR);
  2315   2315   	}
  2316   2316   
  2317   2317   	/* 1.b. Identify Tcl_Objs to use for each argument */
  2318   2318   	sri_obj = objv[1];
  2319   2319   	filename_obj = objv[2];
................................................................................
  2545   2545   	argv[0] = filename;
  2546   2546   	argv[1] = "start";
  2547   2547   	argv[2] = NULL;
  2548   2548   	execve_ret = execve(filename, argv, envv);
  2549   2549   
  2550   2550   	/* 10. Abort if something has gone wrong */
  2551   2551   	_exit(execve_ret);
         2552  +
         2553  +	/* Handle lint-ness */
         2554  +	return(TCL_ERROR);
         2555  +	sri_obj = sri_obj;
  2552   2556   }
  2553   2557   
  2554         -int System_Init(Tcl_Interp *interp) {
         2558  +int Tuapi_Init(Tcl_Interp *interp) {
  2555   2559   #ifdef USE_TCL_STUBS
  2556   2560   	const char *tclInitStubs_ret;
  2557   2561   
  2558   2562   	/* Initialize Stubs */
  2559   2563   	tclInitStubs_ret = Tcl_InitStubs(interp, "8.4", 0);
  2560   2564   	if (!tclInitStubs_ret) {
  2561   2565   		return(TCL_ERROR);
  2562   2566   	}
  2563   2567   #endif
  2564   2568   
  2565   2569   	/* Kernel maintenance related commands */
  2566         -	Tcl_CreateObjCommand(interp, "::system::syscall::insmod", tclsystem_insmod, NULL, NULL);
  2567         -	Tcl_CreateObjCommand(interp, "::system::syscall::rmmod", tclsystem_rmmod, NULL, NULL);
  2568         -	Tcl_CreateObjCommand(interp, "::system::syscall::lsmod", tclsystem_lsmod, NULL, NULL);
  2569         -	Tcl_CreateObjCommand(interp, "::system::syscall::hostname", tclsystem_hostname, NULL, NULL);
  2570         -	Tcl_CreateObjCommand(interp, "::system::syscall::domainname", tclsystem_domainname, NULL, NULL);
         2570  +	Tcl_CreateObjCommand(interp, "::tuapi::syscall::insmod", tuapi_insmod, NULL, NULL);
         2571  +	Tcl_CreateObjCommand(interp, "::tuapi::syscall::rmmod", tuapi_rmmod, NULL, NULL);
         2572  +	Tcl_CreateObjCommand(interp, "::tuapi::syscall::lsmod", tuapi_lsmod, NULL, NULL);
         2573  +	Tcl_CreateObjCommand(interp, "::tuapi::syscall::hostname", tuapi_hostname, NULL, NULL);
         2574  +	Tcl_CreateObjCommand(interp, "::tuapi::syscall::domainname", tuapi_domainname, NULL, NULL);
  2571   2575   
  2572   2576   	/* Block or char device related commands */
  2573         -	Tcl_CreateObjCommand(interp, "::system::syscall::losetup", tclsystem_losetup, NULL, NULL);
         2577  +	Tcl_CreateObjCommand(interp, "::tuapi::syscall::losetup", tuapi_losetup, NULL, NULL);
  2574   2578   
  2575   2579   	/* Filesystem related commands */
  2576         -	Tcl_CreateObjCommand(interp, "::system::syscall::mount", tclsystem_mount, NULL, NULL);
  2577         -	Tcl_CreateObjCommand(interp, "::system::syscall::umount", tclsystem_umount, NULL, NULL);
  2578         -	Tcl_CreateObjCommand(interp, "::system::syscall::swapon", tclsystem_swapon, NULL, NULL);
  2579         -	Tcl_CreateObjCommand(interp, "::system::syscall::swapoff", tclsystem_swapoff, NULL, NULL);
  2580         -	Tcl_CreateObjCommand(interp, "::system::syscall::mknod", tclsystem_mknod, NULL, NULL);
         2580  +	Tcl_CreateObjCommand(interp, "::tuapi::syscall::mount", tuapi_mount, NULL, NULL);
         2581  +	Tcl_CreateObjCommand(interp, "::tuapi::syscall::umount", tuapi_umount, NULL, NULL);
         2582  +	Tcl_CreateObjCommand(interp, "::tuapi::syscall::swapon", tuapi_swapon, NULL, NULL);
         2583  +	Tcl_CreateObjCommand(interp, "::tuapi::syscall::swapoff", tuapi_swapoff, NULL, NULL);
         2584  +	Tcl_CreateObjCommand(interp, "::tuapi::syscall::mknod", tuapi_mknod, NULL, NULL);
  2581   2585   
  2582   2586   	/* Process related commands */
  2583         -	Tcl_CreateObjCommand(interp, "::system::syscall::getuid", tclsystem_getuid, NULL, NULL);
  2584         -	Tcl_CreateObjCommand(interp, "::system::syscall::chroot", tclsystem_chroot, NULL, NULL);
  2585         -	Tcl_CreateObjCommand(interp, "::system::syscall::pivot_root", tclsystem_pivot_root, NULL, NULL);
  2586         -	Tcl_CreateObjCommand(interp, "::system::syscall::kill", tclsystem_kill, NULL, NULL);
  2587         -	Tcl_CreateObjCommand(interp, "::system::syscall::ps", tclsystem_ps, NULL, NULL);
  2588         -	Tcl_CreateObjCommand(interp, "::system::syscall::execve", tclsystem_execve, NULL, NULL);
         2587  +	Tcl_CreateObjCommand(interp, "::tuapi::syscall::getuid", tuapi_getuid, NULL, NULL);
         2588  +	Tcl_CreateObjCommand(interp, "::tuapi::syscall::chroot", tuapi_chroot, NULL, NULL);
         2589  +	Tcl_CreateObjCommand(interp, "::tuapi::syscall::pivot_root", tuapi_pivot_root, NULL, NULL);
         2590  +	Tcl_CreateObjCommand(interp, "::tuapi::syscall::kill", tuapi_kill, NULL, NULL);
         2591  +	Tcl_CreateObjCommand(interp, "::tuapi::syscall::ps", tuapi_ps, NULL, NULL);
         2592  +	Tcl_CreateObjCommand(interp, "::tuapi::syscall::execve", tuapi_execve, NULL, NULL);
  2589   2593   
  2590   2594   	/* Network related commands */
  2591         -	Tcl_CreateObjCommand(interp, "::system::syscall::ifconfig", tclsystem_ifconfig, NULL, NULL);
  2592         -	Tcl_CreateObjCommand(interp, "::system::syscall::route", tclsystem_route, NULL, NULL);
  2593         -	Tcl_CreateObjCommand(interp, "::system::syscall::brctl", tclsystem_brctl, NULL, NULL);
  2594         -	Tcl_CreateObjCommand(interp, "::system::syscall::vconfig", tclsystem_vconfig, NULL, NULL);
         2595  +	Tcl_CreateObjCommand(interp, "::tuapi::syscall::ifconfig", tuapi_ifconfig, NULL, NULL);
         2596  +	Tcl_CreateObjCommand(interp, "::tuapi::syscall::route", tuapi_route, NULL, NULL);
         2597  +	Tcl_CreateObjCommand(interp, "::tuapi::syscall::brctl", tuapi_brctl, NULL, NULL);
         2598  +	Tcl_CreateObjCommand(interp, "::tuapi::syscall::vconfig", tuapi_vconfig, NULL, NULL);
  2595   2599   
  2596   2600   	/* Needed commands for basic services Tcl lacks */
  2597         -	Tcl_CreateObjCommand(interp, "::system::syscall::socket_unix", tclsystem_socket_unix, NULL, NULL);
         2601  +	Tcl_CreateObjCommand(interp, "::tuapi::syscall::socket_unix", tuapi_socket_unix, NULL, NULL);
  2598   2602   
  2599   2603   	/* Service (TSMF) related commands */
  2600         -	Tcl_CreateObjCommand(interp, "::system::syscall::tsmf_start_svc", tclsystem_tsmf_start_svc, NULL, NULL);
         2604  +	Tcl_CreateObjCommand(interp, "::tuapi::syscall::tsmf_start_svc", tuapi_tsmf_start_svc, NULL, NULL);
  2601   2605   
  2602   2606   	/* Internal functions */
  2603         -	Tcl_CreateObjCommand(interp, "::system::internal::hash", tclsystem_internalproc_simplehash, NULL, NULL);
         2607  +	Tcl_CreateObjCommand(interp, "::tuapi::internal::hash", tuapi_internalproc_simplehash, NULL, NULL);
  2604   2608   
  2605   2609   	/* Define constants */
  2606   2610   	/** Create parent namespace **/
  2607         -	Tcl_CreateNamespace(interp, "::system::const", NULL, NULL);
         2611  +	Tcl_CreateNamespace(interp, "::tuapi::const", NULL, NULL);
  2608   2612   
  2609   2613   	/** Define constants, for real **/
  2610         -	Tcl_ObjSetVar2(interp, Tcl_NewStringObj("::system::const::HOST_NAME_MAX", -1), NULL, Tcl_NewWideIntObj(HOST_NAME_MAX), TCL_GLOBAL_ONLY);
         2614  +	Tcl_ObjSetVar2(interp, Tcl_NewStringObj("::tuapi::const::HOST_NAME_MAX", -1), NULL, Tcl_NewWideIntObj(HOST_NAME_MAX), TCL_GLOBAL_ONLY);
  2611   2615   
  2612   2616   	/* Create high-level user functions */
  2613   2617   	Tcl_Eval(interp,
  2614         -#include "system.tcl.h" 
         2618  +#include "tuapi.tcl.h" 
  2615   2619   	);
  2616   2620   
  2617         -	Tcl_PkgProvide(interp, "system", "0.1");
         2621  +	Tcl_PkgProvide(interp, "tuapi", "0.1");
  2618   2622   
  2619   2623   	return(TCL_OK);
  2620   2624   }

Modified system.tcl from [69a9dbf05c] to [dc4245bc68].

     1      1   #! /usr/bin/env tclsh
     2      2   
     3         -namespace eval ::system {}
     4         -namespace eval ::system::helper {}
            3  +namespace eval ::tuapi {}
            4  +namespace eval ::tuapi::helper {}
     5      5   
     6         -set ::system::_mount_flags(bind) BIND
     7         -set ::system::_mount_flags(move) MOVE
     8         -set ::system::_mount_flags(remount) REMOUNT
     9         -set ::system::_mount_flags(mandlock) MANDLOCK
    10         -set ::system::_mount_flags(dirsync) DIRSYNC
    11         -set ::system::_mount_flags(noatime) NOATIME
    12         -set ::system::_mount_flags(nodiratime) NODIRATIME
    13         -set ::system::_mount_flags(relatime) RELATIME
    14         -set ::system::_mount_flags(strictatime) STRICTATIME
    15         -set ::system::_mount_flags(nodev) NODEV
    16         -set ::system::_mount_flags(noexec) NOEXEC
    17         -set ::system::_mount_flags(nosuid) NOSUID
    18         -set ::system::_mount_flags(ro) RDONLY
    19         -set ::system::_mount_flags(silent) SILENT
    20         -set ::system::_mount_flags(synchronous) SYNCHRONOUS
    21         -set ::system::_mount_flags(sync) SYNCHRONOUS
            6  +set ::tuapi::_mount_flags(bind) BIND
            7  +set ::tuapi::_mount_flags(move) MOVE
            8  +set ::tuapi::_mount_flags(remount) REMOUNT
            9  +set ::tuapi::_mount_flags(mandlock) MANDLOCK
           10  +set ::tuapi::_mount_flags(dirsync) DIRSYNC
           11  +set ::tuapi::_mount_flags(noatime) NOATIME
           12  +set ::tuapi::_mount_flags(nodiratime) NODIRATIME
           13  +set ::tuapi::_mount_flags(relatime) RELATIME
           14  +set ::tuapi::_mount_flags(strictatime) STRICTATIME
           15  +set ::tuapi::_mount_flags(nodev) NODEV
           16  +set ::tuapi::_mount_flags(noexec) NOEXEC
           17  +set ::tuapi::_mount_flags(nosuid) NOSUID
           18  +set ::tuapi::_mount_flags(ro) RDONLY
           19  +set ::tuapi::_mount_flags(silent) SILENT
           20  +set ::tuapi::_mount_flags(synchronous) SYNCHRONOUS
           21  +set ::tuapi::_mount_flags(sync) SYNCHRONOUS
    22     22   
    23     23   
    24     24   # Determine where to mount a given device (usually by checking "/etc/fstab")
    25         -proc ::system::helper::find_mountpoint {device} {
           25  +proc ::tuapi::helper::find_mountpoint {device} {
    26     26   	set data ""
    27     27   	catch {
    28     28   		set fd [open "/etc/fstab"]
    29     29   		set data [read -nonewline $fd]
    30     30   		close $fd
    31     31   	}
    32     32   
................................................................................
    48     48   			return [list source $curr_device target $curr_mountpoint fstype $curr_fstype options $curr_opts dumpfreq $curr_dumpfreq fsckpass $curr_fsckpass]
    49     49   		}
    50     50   	}
    51     51   
    52     52   	return -code error "no entry found in \"/etc/fstab\" for \"$device\""
    53     53   }
    54     54   
    55         -proc ::system::mount args {
           55  +proc ::tuapi::mount args {
    56     56   	set options_list [list]
    57     57   
    58     58   	for {set idx 0} {$idx < [llength $args]} {incr idx} {
    59     59   		set curr_arg [lindex $args $idx]
    60     60   
    61     61   		switch -glob -- $curr_arg {
    62     62   			"-t" {
................................................................................
    89     89   			}
    90     90   		}
    91     91   	}
    92     92   
    93     93   	set args [lrange $args $idx end]
    94     94   
    95     95   	if {[llength $args] < 1 || [llength $args] > 2} {
    96         -		return -code error "wrong # args: should be \"::system::mount ?options? source ?target?\""
           96  +		return -code error "wrong # args: should be \"::tuapi::mount ?options? source ?target?\""
    97     97   	}
    98     98   
    99     99   	set source [lindex $args 0]
   100    100   
   101    101   	if {[llength $args] == 2} {
   102    102   		set target [lindex $args 1]
   103    103   	} else {
   104         -		array set mountinfo [::system::helper::find_mountpoint $source]
          104  +		array set mountinfo [::tuapi::helper::find_mountpoint $source]
   105    105   		set source $mountinfo(source)
   106    106   		set target $mountinfo(target)
   107    107   
   108    108   		if {![info exists fstype]} {
   109    109   			set fstype $mountinfo(fstype)
   110    110   		}
   111    111   
................................................................................
   140    140   			}
   141    141   			"norw" {
   142    142   				set option_lc "ro"
   143    143   			}
   144    144   		}
   145    145   
   146    146   		# Example: noatime
   147         -		if {[info exists ::system::_mount_flags($option_lc)]} {
   148         -			lappend options_list $::system::_mount_flags($option_lc)
          147  +		if {[info exists ::tuapi::_mount_flags($option_lc)]} {
          148  +			lappend options_list $::tuapi::_mount_flags($option_lc)
   149    149   
   150    150   			continue
   151    151   		}
   152    152   
   153    153   		# Example: atime
   154         -		if {[info exists ::system::_mount_flags(no$option_lc)]} {
   155         -			set idx [lsearch -exact $options_list $::system::_mount_flags(no$option_lc)]
          154  +		if {[info exists ::tuapi::_mount_flags(no$option_lc)]} {
          155  +			set idx [lsearch -exact $options_list $::tuapi::_mount_flags(no$option_lc)]
   156    156   			if {$idx != -1} {
   157    157   				set options_list [lreplace $options_list $idx $idx]
   158    158   			}
   159    159   
   160    160   			continue
   161    161   		}
   162    162   
   163    163   		# Example: norelatime
   164    164   		if {[string match "no*" $option_lc]} {
   165    165   			set neg_option_lc [string range $option_lc 2 end]
   166    166   
   167         -			if {[info exists ::system::_mount_flags($neg_option_lc)]} {
   168         -				set idx [lsearch -exact $options_list $::system::_mount_flags($neg_option_lc)]
          167  +			if {[info exists ::tuapi::_mount_flags($neg_option_lc)]} {
          168  +				set idx [lsearch -exact $options_list $::tuapi::_mount_flags($neg_option_lc)]
   169    169   				if {$idx != -1} {
   170    170   					set options_list [lreplace $options_list $idx $idx]
   171    171   				}
   172    172   
   173    173   				continue
   174    174   			}
   175    175   		}
................................................................................
   176    176   
   177    177   		# Accumulate unknown options
   178    178   		lappend unknown_options $option
   179    179   	}
   180    180   
   181    181   	# Use "swapon" if this is swap
   182    182   	if {$fstype == "swap"} {
   183         -		return [::system::syscall::swapon $source]
          183  +		return [::tuapi::syscall::swapon $source]
   184    184   	}
   185    185   
   186    186   	# Otherwise, call "mount" system call
   187    187   	## If we have accumulated any unknown options, pass them as a
   188    188   	## comma-seperated value string
   189    189   	if {[info exists unknown_options]} {
   190    190   		set data [join $unknown_options ","]
   191    191   
   192         -		return [::system::syscall::mount $source $target $fstype $options_list $data]
          192  +		return [::tuapi::syscall::mount $source $target $fstype $options_list $data]
   193    193   	}
   194    194   
   195         -	return [::system::syscall::mount $source $target $fstype $options_list]
          195  +	return [::tuapi::syscall::mount $source $target $fstype $options_list]
          196  +}
          197  +
          198  +proc ::tuapi::umount {dir {flags ""}} {
          199  +	return [::tuapi::syscall::umount $dir [string toupper $flags]]
   196    200   }
   197    201   
   198         -proc ::system::umount {dir {flags ""}} {
   199         -	return [::system::syscall::umount $dir [string toupper $flags]]
          202  +proc ::tuapi::kill {pid sig} {
          203  +	return [::tuapi::syscall::kill $pid [string toupper $sig]]
   200    204   }
   201    205   
   202         -proc ::system::kill {pid sig} {
   203         -	return [::system::syscall::kill $pid [string toupper $sig]]
   204         -}
   205         -
   206         -proc ::system::killpg {pgroup sig} {
          206  +proc ::tuapi::killpg {pgroup sig} {
   207    207   	if {$pgroup <= 1} {
   208    208   		return -code error "invalid process group specified (must be greater than 1)"
   209    209   	}
   210    210   
   211         -	return [::system::syscall::kill -$pgroup [string toupper $sig]]
          211  +	return [::tuapi::syscall::kill -$pgroup [string toupper $sig]]
   212    212   }
   213    213   
   214         -proc ::system::ifconfig args {
          214  +proc ::tuapi::ifconfig args {
   215    215   	if {[llength $args] == 0} {
   216    216   		# Return information on all interfaces
   217    217   		set retlist [list]
   218         -		foreach interface [::system::syscall::ifconfig] {
   219         -			lappend retlist $interface [::system::syscall::ifconfig $interface]
          218  +		foreach interface [::tuapi::syscall::ifconfig] {
          219  +			lappend retlist $interface [::tuapi::syscall::ifconfig $interface]
   220    220   		}
   221    221   
   222    222   		return $retlist
   223    223   	}
   224    224   
   225    225   	set interface [lindex $args 0]
   226    226   	set args [lrange $args 1 end]
   227    227   
   228         -	array set ifaceinfo [::system::syscall::ifconfig $interface]
          228  +	array set ifaceinfo [::tuapi::syscall::ifconfig $interface]
   229    229   
   230    230   	if {[llength $args] == 0} {
   231    231   		return [array get ifaceinfo]
   232    232   	}
   233    233   
   234    234   	for {set idx 0} {$idx < [llength $args]} {incr idx} {
   235    235   		set opt [lindex $args $idx]
................................................................................
   244    244   
   245    245   				foreach newflag [list UP RUNNING] {
   246    246   					if {[lsearch -exact $flags $newflag] == -1} {
   247    247   						lappend flags $newflag
   248    248   					}
   249    249   				}
   250    250   
   251         -				::system::syscall::ifconfig $interface flags $flags
          251  +				::tuapi::syscall::ifconfig $interface flags $flags
   252    252   			}
   253    253   
   254    254   		}
   255    255   	}
   256    256   }

Modified test.tcl from [7fb0b14e6d] to [550d4882f7].

     1      1   #! /usr/bin/env tclsh
     2      2   
     3      3   puts [exec ./build-dyn.sh]
     4      4   
     5         -load ./system.so
            5  +load ./tuapi.so
     6      6   
     7         -::system::syscall::tsmf_start_svc blah /bin/true /tmp/logfile [list PATH=/bin] / 022 root root 10
            7  +::tuapi::syscall::tsmf_start_svc blah /bin/true /tmp/logfile [list PATH=/bin] / 022 0 0 10
     8      8   
     9         -foreach iface [system::syscall::ifconfig] {
            9  +foreach iface [tuapi::syscall::ifconfig] {
    10     10   #lo0:2: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
    11     11   #        inet 127.0.0.1 netmask ff000000 
    12     12   #aggr100003:1: flags=201000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4,CoS> mtu 1500 index 2
    13     13   #        inet 140.194.100.149 netmask ffffff00 broadcast 140.194.100.255
    14     14   
    15     15   	unset -nocomplain ifaceinfo
    16         -	array set ifaceinfo [system::syscall::ifconfig $iface]
           16  +	array set ifaceinfo [tuapi::syscall::ifconfig $iface]
    17     17   
    18     18   	set secondline ""
    19     19   	foreach {label entry} [list inet address netmask netmask broadcast broadcast] {
    20     20   		if {![info exists ifaceinfo($entry)]} {
    21     21   			continue
    22     22   		}
    23     23   
................................................................................
    27     27   	puts "$iface: flags=<[join $ifaceinfo(flags) ,]> mtu $ifaceinfo(mtu) index $ifaceinfo(index)"
    28     28   	puts "\t[string trim $secondline]"
    29     29   	if {[info exists ifaceinfo(hwaddr)]} {
    30     30   		puts "\tether $ifaceinfo(hwaddr)"
    31     31   	}
    32     32   }
    33     33   
    34         -#system::syscall::route add 1.2.3.4 255.255.255.255
    35         -system::syscall::ifconfig dummy0 address 1.2.3.4 netmask 255.255.255.0 flags [list UP RUNNING BROADCAST MULTICAST]
           34  +#tuapi::syscall::route add 1.2.3.4 255.255.255.255
           35  +tuapi::syscall::ifconfig dummy0 address 1.2.3.4 netmask 255.255.255.0 flags [list UP RUNNING BROADCAST MULTICAST]