netatalk: unix.c File Reference

netatalk 4.5.1
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
unix.c File Reference
`#include <errno.h>`
`#include <stdlib.h>`
`#include <string.h>`
`#include <sys/param.h>`
`#include <sys/stat.h>`
`#include <sys/types.h>`
`#include <unistd.h>`
`#include <atalk/acl.h>`
`#include <atalk/afp.h>`
`#include <atalk/compat.h>`
`#include <atalk/directory.h>`
`#include <atalk/ea.h>`
`#include <atalk/errchk.h>`
`#include <atalk/logger.h>`
`#include <atalk/unix.h>`
`#include <atalk/util.h>`
`#include <atalk/volume.h>`

## Functions
int | dir_rx_set (mode_t mode)
int | setfilmode (const struct vol *vol, const char *name, mode_t mode, struct stat *st)
int | netatalk_rmdir_all_errors (int dirfd, const char *name)
| system rmdir with afp error code.
int | netatalk_rmdir (int dirfd, const char *name)
| System rmdir with afp error code, but ENOENT is not an error.
int | netatalk_unlink (const char *name)
| system unlink with afp error code.
int | copy_file_fd (int sfd, int dfd)
int | copy_file (int dirfd, const char *src, const char *dst, mode_t mode)
int | copy_ea (const char *ea, int dirfd, const char *src, const char *dst, mode_t mode)
| Copy an EA from one file to another.
int | netatalk_unlinkat (int dirfd, const char *name)
int | unix_rename (int sfd, const char *oldpath, int dfd, const char *newpath)
| This is equivalent of unix rename().
int | statat (int dirfd, const char *path, struct stat *st)
| stat/fsstatat multiplexer
DIR * | opendirat (int dirfd, const char *path)
| opendir wrapper for *at semantics support

## Function Documentation

## ◆ copy_ea()

int copy_ea | ( | const char * | ea,
|  | int | dirfd,
|  | const char * | src,
|  | const char * | dst,
|  | mode_t | mode )

Copy an EA from one file to another.

Note
  Supports *at semantics, pass dirfd=-1 to ignore this

## ◆ copy_file()

int copy_file | ( | int | dirfd,
|  | const char * | src,
|  | const char * | dst,
|  | mode_t | mode )

Supports *at semantics, pass dirfd=-1 to ignore this

## ◆ copy_file_fd()

int copy_file_fd | ( | int | sfd,
|  | int | dfd )

Copy all file data from one file fd to another

## ◆ dir_rx_set()

int dir_rx_set | ( | mode_t | mode | ) |

## ◆ netatalk_rmdir()

int netatalk_rmdir | ( | int | dirfd,
|  | const char * | name )

System rmdir with afp error code, but ENOENT is not an error.

Note
  Supports *at semantics (cf openat). Pass dirfd=-1 to ignore this.

## ◆ netatalk_rmdir_all_errors()

int netatalk_rmdir_all_errors | ( | int | dirfd,
|  | const char * | name )

system rmdir with afp error code.

Note
  Supports *at semantics (cf openat). Pass dirfd=-1 to ignore this.

## ◆ netatalk_unlink()

int netatalk_unlink | ( | const char * | name | ) |

system unlink with afp error code.

Note
  ENOENT is not an error.

## ◆ netatalk_unlinkat()

int netatalk_unlinkat | ( | int | dirfd,
|  | const char * | name )

at wrapper for netatalk_unlink

## ◆ opendirat()

DIR * opendirat | ( | int | dirfd,
|  | const char * | path )

opendir wrapper for *at semantics support

opendirat chdirs to dirfd if dirfd != -1 before calling opendir on path.

Parameters

  [in] | dirfd | if != -1, chdir(dirfd) before opendir(path)
  [in] | path | pathname

## ◆ setfilmode()

int setfilmode | ( | const struct vol * | vol,
|  | const char * | name,
|  | mode_t | mode,
|  | struct stat * | st )

## ◆ statat()

int statat | ( | int | dirfd,
|  | const char * | path,
|  | struct stat * | st )

stat/fsstatat multiplexer

statat mulitplexes stat and fstatat.

Parameters

  [in] | dirfd | -1 gives AT_FDCWD
  [in] | path | pathname
  [in,out] | st | pointer to struct stat

## ◆ unix_rename()

int unix_rename | ( | int | sfd,
|  | const char * | oldpath,
|  | int | dfd,
|  | const char * | newpath )

This is equivalent of unix rename().

unix_rename mulitplexes rename and renameat.

Parameters

  [in] | sfd | -1 gives AT_FDCWD
  [in] | oldpath | guess what
  [in] | dfd | same as sfd
  [in] | newpath | guess what