aboutgitcodelistschat:MatrixIRC
path: root/demo/connect.hjson
blob: 551c335a0ce69836ffe883fc1ceb79609e56f446 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
[
  { /* connect to another path (/cool.sock -> /tmp/demo.sock) */
    "match": [
      { "connect": { "addr": { "family": "unix", "path": "/cool.sock" }, "fd": { "tag": "fd" } } }
    ],
    "call": [
      { "socket": { "family": "unix", "type": "stream", "flags": 0, "protocol": 0 }, "ret": "new_fd" },
      { "connect": { "fd": { "tag": { "get": "new_fd" } }, "addr": { "family": "unix", "path": "/tmp/demo.sock" } }, "ret": "y" }
    ],
    "fd": { "src": { "tag": "fd" }, "new": { "tag": "new_fd" }, "close_on_exec": false },
    "return": { "value": 0, "error": 0 }
  },
  { /* Inject permission denied error */
    "match": [
      { "connect": { "addr": { "family": "unix", "path": "/error.sock" } } }
    ],
    "return": { "value": 0, "error": -1 }
  },
  { /* Continue all the other connect syscall */
    "match": [
      { "connect": {} }
    ],
    "return": { "continue": true }
  }
]