---
name: "af_transact"
section: "3"
platform: "linux"
package: "atfs-dev"
version: "1.4pl6-15+b1"
release: "Debian 12 (Bookworm)"
platforms: ["linux"]
url: "https://new.carta.tech/af_transact"
---

# af\_transact(3)

a simple transaction mechanism for AtFS

## NAME

af\_transaction, af\_commit, af\_abort - a simple transaction mechanism for AtFS

## SYNOPSIS

\#include \<atfs.h\>

int af\_transaction (void)

int af\_commit (void)

int af\_abort (void)

## DESCRIPTION

These functions implement a simple transaction mechanism for AtFS. A transaction starts with calling *af\_transaction*. All changes to existing ASOs performed hereafter have no immediate permanent effect. They rather get into effect, when the transaction is ended. Calling *af\_commit* ends the transactions and causes all changes to be saved to disk. *af\_abort* aborts the transaction without saving the changes. These will then be discarded.

Only modification of the state of existing source ASOs will be deferred. Creation or deletion of ASOs have immediate effect, regardless if a transaction is in effect or not. Additionally, all operations on derived ASOs (all operations on the derived object cache) are not affected by the transaction.

All archive files that are to be changed when the transaction is finished are locked until the end of the transaction. The lock prevents all other applications to perform any modifications on the archive file. You should make sure, that ending a transaction should never be dependent on the successful termination of another application (deadlock danger).

## DIAGNOSTICS

Upon error, -1 is returned and *af\_errno* is set to the corresponding error number.

## BUGS

Changes to the contents of busy versions have immediate effect.
