---
name: "lc_syncfilelocal"
section: "3"
platform: "linux"
package: "liblibrecast-dev"
version: "0.9.1-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/lc_syncfilelocal"
---

# lc\_syncfilelocal(3)

synchronize two local files

## NAME

lc\_syncfilelocal - synchronize two local files

## LIBRARY

Librecast library (*liblibrecast*, *-llibrecast*)

## SYNOPSIS

```
#include <librecast/sync.h>
```

**int lc\_syncfilelocal(const char** *\*dst***, const char** *\*src***, q\_t** *\*q*         **lc\_stat\_t** *\*stats***, lc\_sync\_options\_t** *\*opt***, int** *flags***);**

Compile and link with *-llibrecast*.

## DESCRIPTION

The **lc\_syncfilelocal**() function synchronizes the file at *dst* with the file at *src* by overwriting *dst* with bytes from *src*. If *dst* does not exist, it is created.

If *q* is not NULL, it must point to a queue *q\_t* structure previously initialized with [**q\_init**(3)](/q_init/3.md). This queue will have jobs enqueued to build the tree. This is normally used in conjunction with a threadpool created with [**q\_pool\_create**(3)](/q_pool_create/3.md) with threads all calling [**q\_job\_seek**(3)](/q_job_seek/3.md).

If *q* is NULL, the creation and destruction of a queue and threadpool will be handled automatically.

If *stats* is not NULL, transfer statistics will be returned in this structure.

*opt* is not used, at present, and must be NULL for compatibility with future versions.

The *flags* argument is the bitwise OR of zero of more of the following flags:

- **MDEX\_RECURSE**

  recursively index directories.

## RETURN VALUE

The **lc\_syncfilelocal**() function returns zero on success, or -1 if an error occurred. In the event of an error, *errno* is set to indicate the error.

## ERRORS

- **EINVAL**

  Invalid argument.

**ENOMEM** Not enough space/cannot allocate memory (POSIX.1-2001).

**lc\_syncfilelocal**() can also fail with any of the errors for [**mmap**(2)](/mmap/2.md) or [**chmod**(2)](/chmod/2.md).

## SEE ALSO

[**lc\_memsync**(3)](/lc_memsync/3.md), [**lc\_sync**(3)](/lc_sync/3.md), [**lc\_syncfile**(3)](/lc_syncfile/3.md), [**q\_init**(3)](/q_init/3.md), [**q\_free**(3)](/q_free/3.md), [**q\_pool\_create**(3)](/q_pool_create/3.md), [**q\_pool\_destroy**(3)](/q_pool_destroy/3.md), [**q\_job\_seek**(3)](/q_job_seek/3.md), [**chmod**(2)](/chmod/2.md), [**mmap**(2)](/mmap/2.md)
