---
name: "acl_copy_ext"
section: "3"
platform: "macos"
package: "Libc"
version: "1752.120.2"
release: "macOS 26.5"
platforms: ["linux", "macos"]
url: "https://new.carta.tech/acl_copy_ext"
---

# acl\_copy\_ext(3)

convert an ACL to and from an external representation

## NAME

**acl\_copy\_ext**, **acl\_copy\_ext\_native**, **acl\_copy\_int**, **acl\_copy\_int\_native,** **acl\_size** – convert an ACL to and from an external representation

## SYNOPSIS

**#include \<sys/types.h\>**

**#include \<sys/acl.h\>**

*ssize\_t*\

**acl\_copy\_ext**(*void \*buf*, *acl\_t acl*, *ssize\_t size*);

*ssize\_t*\

**acl\_copy\_ext\_native**(*void \*buf*, *acl\_t acl*, *ssize\_t size*);

*acl\_t*\

**acl\_copy\_int**(*const void \*buf*);

*acl\_t*\

**acl\_copy\_int\_native**(*const void \*buf*);

*ssize\_t*\

**acl\_size**(*acl\_t acl*);

## DESCRIPTION

The **acl\_copy\_ext**() and **acl\_copy\_ext\_native**() functions convert the ACL given by the argument *acl* into a binary external representation that can be saved to a file, passed to another program, etc. This external representation is written to the buffer pointed to by the argument *buf*, which is assumed to have at least the number of contiguous bytes passed in the *size* argument. The number of bytes actually written is returned.

The **acl\_copy\_ext**() function writes data in big-endian byte-order, and so is portable across machines with different byte-order. To the contrary, the **acl\_copy\_ext\_native**() function uses the machine's native byte-order, and so is only portable to machines of like byte-order.

The **acl\_copy\_int**() and **acl\_copy\_int\_native**() functions do the reverse conversion; the ACL represented by the external representation passed in the argument *buf*, is returned. The **acl\_copy\_int**() function expects an external representation in big-endian byte-order (as returned by **acl\_copy\_ext**()), while **acl\_copy\_int\_native**() expects an external representation in native byte-order (as returned by **acl\_copy\_ext\_native**()).

The **acl\_size**() function returns the corresponding external representation size, in bytes, for the given ACL passed in the argument *acl*. This size can be used to allocate sufficient memory for the buffer in subsequent calls to **acl\_copy\_ext**() and **acl\_copy\_ext\_native**().

## RETURN VALUES

Upon successful completion, the **acl\_copy\_ext**() and **acl\_copy\_ext\_native**() functions shall return the number of bytes actually written to the buffer. Otherwise, a value of *-1* shall be returned and *errno* shall be set to indicate the error.

Upon successful completion, the **acl\_copy\_int**() and **acl\_copy\_int\_native**() functions shall return the ACL represented by the external representation passed in the buffer. Otherwise, a value of *(acl\_t)NULL* shall be returned and *errno* shall be set to indicate the error.

Upon successful completion, the **acl\_size**() function shall return the size of the external representation. Otherwise, a value of *-1* shall be returned and *errno* shall be set to indicate the error.

## ERRORS

The **acl\_copy\_ext**() and **acl\_copy\_ext\_native**() functions fail if:

- \[EINVAL\]

  Argument *acl* does not point to a valid ACL.

- \[ERANGE\]

  The given buffer is too small to contain the converted external representation.

The **acl\_copy\_int**() and **acl\_copy\_int\_native**() functions fail if:

- \[EINVAL\]

  The buffer does not contain a valid external representation.

The **acl\_size**() function fails if:

- \[EINVAL\]

  Argument *acl* does not point to a valid ACL.

## NOTE

While the external representation may use pre-existing data structures, no assumptions on the internal structure should be made.

The [acl\_to\_text(3)](/acl_to_text/3.md) and [acl\_from\_text(3)](/acl_from_text/3.md) functions also convert to and from a different external representation, a human-readable string. Neither of these representations are cross-platform, lacking a cross-platform standard.

## SEE ALSO

[acl(3)](/acl/3.md), [acl\_from\_text(3)](/acl_from_text/3.md), [acl\_to\_text(3)](/acl_to_text/3.md)

## AUTHORS

Michael Smith Robert N M Watson
