2 System Calls Using Go

The operating system provides a lot of ways for applications to extract information and perform operations. You will look at the different ways to extract system-level information and use both the Go standard library and system files.

  • Syscall Package
    The syscall package is the standard library provided by Go that provides function calls that interface with the log-level operating system. The following are some of the functionalities provided by the package:
    • Change directory
    • Duplicate file descriptor
    • Get current working directory
    • ...and many more
    package main
    import (
    "log"
    s "syscall" )
    func main() {
    ...
    log.Println("Getpid : ", s.Getpid())
    ...
    _, err := s.Getcwd(c)
    ... }
  • ELF Package

High-Level ELF Format
ELF is a common standard file format for executable files, object code,
shared libraries, and core dumps; it is cross platform.
image

posted on 2023-01-28 10:29  bcb51  阅读(14)  评论(0)    收藏  举报