---
name: "gfs_pio_sendfile"
section: "3"
platform: "linux"
package: "libgfarm-dev"
version: "2.7.20+dfsg-1.2+b1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/gfs_pio_sendfile"
---

# gfs\_pio\_sendfile(3)

receive a Gfarm file to local machine

## NAME

gfs\_pio\_sendfile - receive a Gfarm file to local machine

## SYNOPSIS

```
#include <gfarm/gfarm.h>
```

**gfarm\_error\_t gfs\_pio\_sendfile(GFS\_File** *w\_gf***, gfarm\_off\_t** *w\_off***, int** *r\_fd***, gfarm\_off\_t** *r\_off***, gfarm\_off\_t** *len***, gfarm\_off\_t \*** *sentp***);**

## DESCRIPTION

Sends *len* bytes of data from the position specified by the offset *r\_off* in a local file which is pointed by a file descriptor *r\_fd*, to the position specified by the offset *w\_off* of a Gfarm file *w\_gf*. If len is -1, this function transfers until the end of the file. The transfered bytes will be stored to the memory pointed by *sentp* when *sentp* is not **NULL**. If *len* is a positive value, and the value pointed by *sentp* is less than *len*, that means the transfer reached EOF.

## RETURN VALUES

**GFARM\_ERR\_NO\_ERROR**

The function terminated successfully.

**GFARM\_ERR\_OPERATION\_NOT\_PERMITTED**

*gf* does not specify a regular file.

**GFARM\_ERR\_BAD\_FILE\_DESCRIPTOR**

The file descripter specified by *gf* is not a valid or is not open for reading.

**GFARM\_ERR\_NO\_FILE\_SYSTEM\_NODE**

There is no available file system node.

**GFARM\_ERR\_NO\_MEMORY**

Insufficient memory was available.

Others

An error except the above occurred. The reason is shown by **gfarm\_error\_string**(3).

## SEE ALSO

[**gfs\_pio\_create**(3)](/gfs_pio_create/3.md), [**gfs\_pio\_open**(3)](/gfs_pio_open/3.md), [**gfs\_pio\_write**(3)](/gfs_pio_write/3.md), [**gfs\_pio\_recvfile**(3)](/gfs_pio_recvfile/3.md)
