Giter Site home page Giter Site logo

go-syscall-with-strace's Introduction

go-syscall-with-strace

This is a sample of an application built in Go using the strace command to see what system-calls are being call.

Go Version

Go version

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.5 LTS
Release:        20.04
Codename:       focal

$ go version
go version go1.19.4 linux/amd64

How to Run

Using go-task

run

$ task run
task: [run] go build -o ./app
task: [run] strace -y -f -e openat,read,write,clone,close ./app 2>&1 1>/dev/null | tee syscall.log
openat(AT_FDCWD, "/sys/kernel/mm/transparent_hugepage/hpage_pmd_size", O_RDONLY) = 3</sys/kernel/mm/transparent_hugepage/hpage_pmd_size>
read(3</sys/kernel/mm/transparent_hugepage/hpage_pmd_size>, "2097152\n", 20) = 8
close(3</sys/kernel/mm/transparent_hugepage/hpage_pmd_size>) = 0
clone(child_stack=0xc000074000, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLSstrace: Process 7511 attached
, tls=0xc000064090) = 7511
[pid  7510] clone(child_stack=0xc000076000, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLSstrace: Process 7512 attached
, tls=0xc000064490) = 7512
[pid  7510] clone(child_stack=0xc000070000, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLSstrace: Process 7513 attached
, tls=0xc000064890) = 7513
[pid  7512] clone(child_stack=0xc000112000, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLSstrace: Process 7514 attached
, tls=0xc000100090) = 7514
[pid  7510] openat(AT_FDCWD, "out.txt", O_RDWR|O_CREAT|O_TRUNC|O_CLOEXEC, 0666) = 3</workspace/go-syscall-with-strace/out.txt>
[pid  7510] write(3</workspace/go-syscall-with-strace/out.txt>, "1\n", 2) = 2
[pid  7510] write(3</workspace/go-syscall-with-strace/out.txt>, "2\n", 2) = 2
[pid  7510] write(3</workspace/go-syscall-with-strace/out.txt>, "3\n", 2) = 2
[pid  7512] write(3</workspace/go-syscall-with-strace/out.txt>, "4\n", 2) = 2
[pid  7512] write(3</workspace/go-syscall-with-strace/out.txt>, "5\n", 2) = 2
[pid  7514] close(3</workspace/go-syscall-with-strace/out.txt>) = 0
[pid  7514] +++ exited with 0 +++
[pid  7513] +++ exited with 0 +++
[pid  7512] +++ exited with 0 +++
[pid  7511] +++ exited with 0 +++
+++ exited with 0 +++

clean

$ task clean
task: [clean] rm -f ./app out.txt syscall.log

go-syscall-with-strace's People

Contributors

devlights avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.