---
name: "sockfd_lookup"
section: "9"
platform: "linux"
package: "linux-manual-4.9"
version: "4.9.228-1"
release: "Debian 9 (Stretch)"
platforms: ["linux"]
url: "https://new.carta.tech/sockfd_lookup"
---

# sockfd\_lookup(9)

Go from a file number to its socket slot

## NAME

sockfd\_lookup - Go from a file number to its socket slot

## SYNOPSIS

**struct socket \* sockfd\_lookup(int** *fd***, int \*** *err***);**

## ARGUMENTS

*fd*

file handle

*err*

pointer to an error code return

## DESCRIPTION

The file handle passed in is locked and the socket it is bound too is returned. If an error occurs the err pointer is overwritten with a negative errno code and NULL is returned. The function checks for both invalid handles and passing a handle which is not a socket.

On a success the socket object pointer is returned.

## COPYRIGHT
