448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
|
return(TCL_OK);
}
static int tuapi_insmod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
Tcl_Channel fd;
Tcl_Obj *module_filename, *module_data;
void *module_data_val;
int module_data_len;
int read_ret, chk_ret;
if (objc < 2) {
Tcl_SetObjResult(interp, Tcl_NewStringObj("wrong # args: should be \"tuapi::syscall::insmod filename ?args ...?\"", -1));
return(TCL_ERROR);
}
module_filename = objv[1];
fd = Tcl_FSOpenFileChannel(interp, module_filename, "r", 0600);
|
>
|
|
|
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
|
return(TCL_OK);
}
static int tuapi_insmod(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
Tcl_Channel fd;
Tcl_Obj *module_filename, *module_data;
void *module_data_val;
const char *module_opts;
int module_data_len;
int read_ret, chk_ret;
if (objc < 2 || objc > 3) {
Tcl_SetObjResult(interp, Tcl_NewStringObj("wrong # args: should be \"tuapi::syscall::insmod filename ?args?\"", -1));
return(TCL_ERROR);
}
module_filename = objv[1];
fd = Tcl_FSOpenFileChannel(interp, module_filename, "r", 0600);
|
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
|
Tcl_SetObjResult(interp, Tcl_NewStringObj("read failed", -1));
return(TCL_ERROR);
}
module_data_val = Tcl_GetByteArrayFromObj(module_data, &module_data_len);
chk_ret = init_module(module_data_val, module_data_len, "");
if (chk_ret != 0) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(strerror(errno), -1));
return(TCL_ERROR);
}
return(TCL_OK);
|
>
>
>
>
>
>
|
|
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
|
Tcl_SetObjResult(interp, Tcl_NewStringObj("read failed", -1));
return(TCL_ERROR);
}
module_data_val = Tcl_GetByteArrayFromObj(module_data, &module_data_len);
if (objc == 3) {
module_opts = Tcl_GetString(objv[2]);
} else {
module_opts = "";
}
chk_ret = init_module(module_data_val, module_data_len, module_opts);
if (chk_ret != 0) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(strerror(errno), -1));
return(TCL_ERROR);
}
return(TCL_OK);
|