How to customize system calls in gVisor? - system-calls

I am a student and try to customize the system calls in gVisor. I have successfully compiled the gVisor on go-branch. And I have got the right message when I change the pkg/sentry/kernel/syslog.go file. Here is the result that can show I have successfully compiled the runsc (the runtime of gVisor).
sudo docker run --runtime=runsc -it ubuntu dmesg
[ 0.000000] asdf Starting gVisor...
[ 0.360765] 6666...
[ 0.529799] 5555...
[ 0.959593] iiiiii...
[ 1.343602] 7777...
[ 1.347068] 4444...
[ 1.424063] 00000...
[ 1.470641] 22222...
[ 1.858755] 99999...
[ 2.213219] 8888...
[ 2.679995] cccccc ..
[ 2.943468] asdf asdf Setting up VFS2...
[ 3.429006] Ready!
And I have noticed the package gvisor/pkg/sentry/syscalls/linux which contains all the syscalls and they are registered in file gvisor/pkg/sentry/syscalls/linux/linux64.go. However, I failed to customize the syscalls in gVisor.
Thanks very much.

Related

use a `task` to export a workspace-specific environment variable: $PATH?

I have several workspaces that have unique environments.
When I load a workspace, I would like to update the linux $PATH accordingly, however, I tried the following:
### workspace.code-workspace
{
"folders": [
{
"path": "."
}
],
"settings": {},
"tasks": [
{
"command": "export $PATH=${workspaceFolder}/bin:$PATH"
}
]
}
Which fails according to:
me#pc:~/Containers/cuda_devcon/project$ ls -alvh ./bin/julia
lrwxrwxrwx 1 me me 21 Jan 29 17:38 ./bin/julia -> julia-1.6.7/bin/julia
me#pc:~/Containers/cuda_devcon/project$ which julia
me#pc:~/Containers/cuda_devcon/project$ julia
Command 'julia' not found, but can be installed with:
sudo snap install julia # version 1.8.5, or
sudo apt install julia # version 1.4.1+dfsg-1
See 'snap info julia' for additional versions.

How does the chain edge connection works in Jaseci?

I'm new to Jaseci world. Here I'm trying to figure out how the chaining edge connections between nodes works in jaseci. In the following code snippet was taken from the Jaseci Bible.
node person;
edge friend;
edge family;
walker init {
node1 = spawn node::person;
node2 = spawn node::person;
node2 <-[friend]- here -[friend]-> node1 <-[family]-> node2;
}
According to the bible the graph is as follows;
The chain connection works left to right. I don't get how the line node2 <-[friend]- here -[friend]-> node1 <-[family]-> node2; creates the e1 edge. Can someone help me to understand this?.
It appears the diagram doesn't match the code. Must be an error in the Bible. I just plopped your code example in a file and ran it with jsctl -m jac dot nextion.jac. I got this output:
strict digraph root {
"n0" [ label="n0:root" ]
"n1" [ label="n1:person" ]
"n2" [ label="n2:person" ]
"n0" -> "n1" [ label="e0:friend" ]
"n0" -> "n2" [ label="e1:friend" ]
"n1" -> "n2" [ label="e2:family", dir="both" ]
}
If you render this in graphviz online it looks like

vscode+Arduino environment: vscode is not able to load system headers despite the configuration of paths

I'm really getting frustrated with this issue.
I have installed vscode(version: 1.69.2) & Arduino IDE(version 1.8.20) on my MacOS(version 12.5), I installed the Arduino extension in the vscode, and tried to get it work.
It just works fine if I don't include the system libraries, however if I tried to include a header file, example, the 'iostream', the complier prompts me as below:
Alternatives for iostream: []
ResolveLibrary(iostream)
-> candidates: []
main:1:10: fatal error: iostream: No such file or directory
#include <iostream>
^~~~~~~~~~
compilation terminated.
exit status 1
It looks like the VScode IntelliSense could find this file, if I click this file with Command key pressed, it will show me the location of it.
iostream can be found by vscode IntelliSense
I'm assuming that IntelliSense works with the paths I set, but the compiler just cannot, I tried editing the json file several hours last night but still no luck.
Anyone has any idea about this? Your help is greatly appreciated!
Here's part of my c_cpp_properties.json file:
{
"version": 4,
"configurations": [
{
"name": "Arduino",
"compilerPath": "/Users/steveyang/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++",
"compilerArgs": [
"-w",
"-std=gnu++11",
"-fpermissive",
"-fno-exceptions",
"-ffunction-sections",
"-fdata-sections",
"-fno-threadsafe-statics",
"-Wno-error=narrowing"
],
"intelliSenseMode": "gcc-x64",
"includePath": [
"${workspaceFolder}",
"/Users/steveyang/Library/Arduino15/packages/arduino/hardware/avr/1.8.5/cores/arduino",
"/Users/steveyang/Library/Arduino15/packages/arduino/hardware/avr/1.8.5/variants/standard",
"/Users/steveyang/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/lib/gcc/avr/7.3.0/include",
"/Users/steveyang/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/lib/gcc/avr/7.3.0/include-fixed",
"/Users/steveyang/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/avr/include"
],
"forcedInclude": [
"/Users/steveyang/Library/Arduino15/packages/arduino/hardware/avr/1.8.5/cores/arduino/Arduino.h"
],
"cStandard": "c11",
"cppStandard": "c++11",
"defines": [....
],
"browse": {
"path":[
"${workspaceFolder}/",
"/usr/local/include",
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1",
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.1.6/include",
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include",
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include"
]
}
}
]
}

vscode remote container extension launching got stuck at "installing extensions"

When I am using this remote container extension for launching a container, sometime it will stuck at "installing extensions".
It will stuck at this state as follow for a long time and no response.
Sometime it works fine and fast, sometime does not.
I have commented all the extensions in devcontainer.json file but it still happens sometime.
I dont know whether it a network issue or something else. And I want to know how can I make it stable?
Thanks!
This is my devcontainer.json.
{
"name": "gazebo_ros_docker",
"dockerFile": "Dockerfile",
"extensions": [
// "ms-iot.vscode-ros",
// "ms-vscode.cpptools",
// "mhutchie.git-graph"
],
"runArgs": [
"-it",
"--rm",
"--privileged",
"-e ROS_HOSTNAME=localhost",
"-e ROS_MASTER_URI=http://localhost:11311",
"--name=ros_container",
],
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},
// "postCreateCommand": "bash /catkin_ws/src/panda_simulation/scripts/docker-setup.sh",
"workspaceMount": "source=${localWorkspaceFolder},target=/catkin_ws,type=bind",
// "workspaceMount": "source=${localWorkspaceFolder},target=/catkin_ws,type=bind,consistency=delegated",
"workspaceFolder": "/catkin_ws",
"mounts": [
"source=/tmp/.X11-unix,target=/tmp/.X11-unix,type=bind",
],
"containerEnv": {
"DISPLAY": "${localEnv:DISPLAY}",
},
"containerUser": "docker_ros"
}
I did not find the best way to solve this problem. But I export the images of the vscode-processed container and launch it. It is working well now.

How to setup powerline-go in vscode running in WSL2 (Ubuntu)

These are the contents of my ~/.vscode-server/server-env-setup
function _update_ps1() {
PS1="$($GOPATH/bin/powerline-go -error $?)"
}
if [ "$TERM" != "linux" ] && [ -f "$GOPATH/bin/powerline-go" ]; then
PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND"
fi
... gives this error
[2019-12-10 13:49:39.763] /mnt/c/Users/cber/.vscode/extensions/ms-vscode-remote.remote-wsl-0.40.3/scripts/wslServer.sh: 1: /home/cber/.vscode-server/server-env-setup: Syntax error: "(" unexpected
[2019-12-10 13:49:39.805] VS Code Server for WSL closed unexpectedly.
UPDATE
This version (stripped of windows line endings) does not produce any errors, but unfortunately also does not display anything in the prompt in a git repo:
GOPATH=$HOME/go
_update_ps1() {
PS1="$($GOPATH/bin/powerline-go -error $?)"
}
if [ "$TERM" != "linux" ] && [ -f "$GOPATH/bin/powerline-go" ]; then
PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND"
fi