Golang os.Getppid() Function with Examples

Golang | os.Getppid() Function: Here, we are going to learn about the Getppid() function of the os package with its usages, syntax, and examples.
Submitted by IncludeHelp, on November 19, 2021


In the Go language, the os package provides a platform-independent interface to operating system (Unix-like) functionality. The Getppid() function is an inbuilt function of the os package, it is used to get the process id of the caller's parent.

It accepts nothing and returns an integer that is the process id of the caller's parent.


func Getppid() int


  • None

Return Value:

The return type of the os.Getppid() function is an int, it returns the process id of the caller's parent.


// Golang program to demonstrate the
// example of Getppid() function

package main

import (

func main() {
	ppid := os.Getppid()

	fmt.Printf("ppid: %T, %v\n",
		ppid, ppid)


ppid: int, 1150

Golang os Package »

Comments and Discussions!

Load comments ↻

Copyright © 2024 www.includehelp.com. All rights reserved.