Check-in [5405269774]
Overview
SHA1:5405269774fe6308e032638a86efd61ccd40420c
Date: 2014-12-25 04:09:44
User: rkeene
Comment:Added "reboot" command and stub for "eject" command
Timelines: family | ancestors | descendants | both | trunk
Downloads: Tarball | ZIP archive
Other Links: files | file ages | folders | manifest
Tags And Properties
Context
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)
2014-12-23
08:05
[9839015dcd] Added a simple "waitpid" implementation (user: rkeene, tags: trunk)
Changes

Modified tuapi.c from [a87ca8451c] to [5789ec5d76].

     1      1   #define _LINUX_SOURCE 1
     2      2   #include <sys/resource.h>
     3      3   #include <sys/syscall.h>
     4      4   #include <sys/termios.h>
     5      5   #include <netinet/in.h>
            6  +#include <sys/reboot.h>
     6      7   #include <arpa/inet.h>
     7      8   #include <sys/socket.h>
     8      9   #include <sys/select.h>
     9     10   #include <sys/mount.h>
    10     11   #include <sys/types.h>
    11     12   #include <sys/ioctl.h>
    12     13   #include <sys/time.h>
................................................................................
   790    791   		Tcl_SetObjResult(interp, Tcl_NewStringObj(strerror(errno), -1));
   791    792   
   792    793   		return(TCL_ERROR);
   793    794   	}
   794    795   
   795    796   	return(TCL_OK);
   796    797   }
          798  +
          799  +static int tuapi_reboot(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
          800  +	sync();
          801  +	reboot(RB_AUTOBOOT);
          802  +
          803  +	Tcl_SetObjResult(interp, Tcl_NewStringObj(strerror(errno), -1));
          804  +
          805  +	return(TCL_ERROR);
          806  +}
          807  +
          808  +static int tuapi_eject(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
          809  +	Tcl_SetObjResult(interp, Tcl_NewStringObj("not implemented", -1));
          810  +
          811  +	return(TCL_ERROR);
          812  +}
   797    813   
   798    814   static int tuapi_ps(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
   799    815   	Tcl_SetObjResult(interp, Tcl_NewStringObj("not implemented", -1));
   800    816   
   801    817   	return(TCL_ERROR);
   802    818   }
   803    819   
................................................................................
  3000   3016   	Tcl_CreateObjCommand(interp, "::tuapi::syscall::lsmod", tuapi_lsmod, NULL, NULL);
  3001   3017   	Tcl_CreateObjCommand(interp, "::tuapi::syscall::hostname", tuapi_hostname, NULL, NULL);
  3002   3018   	Tcl_CreateObjCommand(interp, "::tuapi::syscall::domainname", tuapi_domainname, NULL, NULL);
  3003   3019   	Tcl_CreateObjCommand(interp, "::tuapi::syscall::klogctl", tuapi_klogctl, NULL, NULL);
  3004   3020   
  3005   3021   	/* Block or char device related commands */
  3006   3022   	Tcl_CreateObjCommand(interp, "::tuapi::syscall::losetup", tuapi_losetup, NULL, NULL);
         3023  +	Tcl_CreateObjCommand(interp, "::tuapi::syscall::eject", tuapi_eject, NULL, NULL);
  3007   3024   
  3008   3025   	/* Filesystem related commands */
  3009   3026   	Tcl_CreateObjCommand(interp, "::tuapi::syscall::mount", tuapi_mount, NULL, NULL);
  3010   3027   	Tcl_CreateObjCommand(interp, "::tuapi::syscall::umount", tuapi_umount, NULL, NULL);
  3011   3028   	Tcl_CreateObjCommand(interp, "::tuapi::syscall::swapon", tuapi_swapon, NULL, NULL);
  3012   3029   	Tcl_CreateObjCommand(interp, "::tuapi::syscall::swapoff", tuapi_swapoff, NULL, NULL);
  3013   3030   	Tcl_CreateObjCommand(interp, "::tuapi::syscall::mknod", tuapi_mknod, NULL, NULL);
................................................................................
  3017   3034   	Tcl_CreateObjCommand(interp, "::tuapi::syscall::chroot", tuapi_chroot, NULL, NULL);
  3018   3035   	Tcl_CreateObjCommand(interp, "::tuapi::syscall::pivot_root", tuapi_pivot_root, NULL, NULL);
  3019   3036   	Tcl_CreateObjCommand(interp, "::tuapi::syscall::kill", tuapi_kill, NULL, NULL);
  3020   3037   	Tcl_CreateObjCommand(interp, "::tuapi::syscall::waitpid", tuapi_waitpid, NULL, NULL);
  3021   3038   	Tcl_CreateObjCommand(interp, "::tuapi::syscall::ps", tuapi_ps, NULL, NULL);
  3022   3039   	Tcl_CreateObjCommand(interp, "::tuapi::syscall::execve", tuapi_execve, NULL, NULL);
  3023   3040   	Tcl_CreateObjCommand(interp, "::tuapi::syscall::rlimit", tuapi_rlimit, NULL, NULL);
         3041  +	Tcl_CreateObjCommand(interp, "::tuapi::syscall::reboot", tuapi_reboot, NULL, NULL);
  3024   3042   
  3025   3043   	/* Network related commands */
  3026   3044   	Tcl_CreateObjCommand(interp, "::tuapi::syscall::ifconfig", tuapi_ifconfig, NULL, NULL);
  3027   3045   	Tcl_CreateObjCommand(interp, "::tuapi::syscall::route", tuapi_route, NULL, NULL);
  3028   3046   	Tcl_CreateObjCommand(interp, "::tuapi::syscall::brctl", tuapi_brctl, NULL, NULL);
  3029   3047   	Tcl_CreateObjCommand(interp, "::tuapi::syscall::vconfig", tuapi_vconfig, NULL, NULL);
  3030   3048