Check-in [f73c910cba]
Overview
SHA1:f73c910cba5b41e5a6aa13ac0535ecf1d03211be
Date: 2015-02-04 16:19:35
User: rkeene
Comment:Added settimeofday
Timelines: family | ancestors | descendants | both | trunk
Downloads: Tarball | ZIP archive
Other Links: files | file ages | folders | manifest
Tags And Properties
Context
2015-02-13
19:16
[6c60df91c9] Updated to allow scan_and_load_kernel_modules to be supplied arguments for kernel modules (user: rkeene, tags: trunk)
2015-02-04
16:19
[f73c910cba] Added settimeofday (user: rkeene, tags: trunk)
2014-12-25
04:09
[5405269774] Added "reboot" command and stub for "eject" command (user: rkeene, tags: trunk)
Changes

Modified tuapi.c from [5789ec5d76] to [2a68e00137].

  2279   2279   
  2280   2280   	if (child != 0) {
  2281   2281   		Tcl_SetObjResult(interp, Tcl_NewWideIntObj(child));
  2282   2282   	}
  2283   2283   
  2284   2284   	return(TCL_OK);
  2285   2285   }
         2286  +
         2287  +static int tuapi_settimeofday(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
         2288  +	struct timeval tv;
         2289  +	Tcl_WideInt tv_sec_val, tv_usec_val;
         2290  +	int settimeofday_ret, tcl_ret;
         2291  +
         2292  +	if (objc != 3) {
         2293  +		Tcl_SetObjResult(interp, Tcl_NewStringObj("wrong # args: should be \"::tuapi::syscall::settimeofday seconds microseconds\"", -1));
         2294  +
         2295  +		return(TCL_ERROR);
         2296  +	}
         2297  +
         2298  +	tcl_ret = Tcl_GetWideIntFromObj(interp, objv[1], &tv_sec_val);
         2299  +	if (tcl_ret != TCL_OK) {
         2300  +		return(tcl_ret);
         2301  +	}
         2302  +
         2303  +	tcl_ret = Tcl_GetWideIntFromObj(interp, objv[2], &tv_usec_val);
         2304  +	if (tcl_ret != TCL_OK) {
         2305  +		return(tcl_ret);
         2306  +	}
         2307  +
         2308  +	tv.tv_sec = tv_sec_val;
         2309  +	tv.tv_usec = tv_usec_val; 
         2310  +
         2311  +	settimeofday_ret = settimeofday(&tv, NULL);
         2312  +
         2313  +	if (settimeofday_ret < 0) {
         2314  +		Tcl_SetObjResult(interp, Tcl_NewStringObj(strerror(errno), -1));
         2315  +
         2316  +		return(TCL_ERROR);
         2317  +	}
         2318  +
         2319  +	return(TCL_OK);
         2320  +}
  2286   2321   
  2287   2322   #ifndef DISABLE_UNIX_SOCKETS
  2288   2323   struct tuapi_socket_unix__chan_id {
  2289   2324   	int fd;
  2290   2325   	Tcl_Channel chan;
  2291   2326   };
  2292   2327   
................................................................................
  3013   3048   	/* Kernel maintenance related commands */
  3014   3049   	Tcl_CreateObjCommand(interp, "::tuapi::syscall::insmod", tuapi_insmod, NULL, NULL);
  3015   3050   	Tcl_CreateObjCommand(interp, "::tuapi::syscall::rmmod", tuapi_rmmod, NULL, NULL);
  3016   3051   	Tcl_CreateObjCommand(interp, "::tuapi::syscall::lsmod", tuapi_lsmod, NULL, NULL);
  3017   3052   	Tcl_CreateObjCommand(interp, "::tuapi::syscall::hostname", tuapi_hostname, NULL, NULL);
  3018   3053   	Tcl_CreateObjCommand(interp, "::tuapi::syscall::domainname", tuapi_domainname, NULL, NULL);
  3019   3054   	Tcl_CreateObjCommand(interp, "::tuapi::syscall::klogctl", tuapi_klogctl, NULL, NULL);
         3055  +	Tcl_CreateObjCommand(interp, "::tuapi::syscall::settimeofday", tuapi_settimeofday, NULL, NULL);
  3020   3056   
  3021   3057   	/* Block or char device related commands */
  3022   3058   	Tcl_CreateObjCommand(interp, "::tuapi::syscall::losetup", tuapi_losetup, NULL, NULL);
  3023   3059   	Tcl_CreateObjCommand(interp, "::tuapi::syscall::eject", tuapi_eject, NULL, NULL);
  3024   3060   
  3025   3061   	/* Filesystem related commands */
  3026   3062   	Tcl_CreateObjCommand(interp, "::tuapi::syscall::mount", tuapi_mount, NULL, NULL);