netatalk  4.5.0
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
unix.h File Reference
#include <dirent.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <atalk/globals.h>

Go to the source code of this file.

Macros

#define NETATALK_DIOSZ_STACK   65536
 
#define NETATALK_DIOSZ_HEAP   (1024*1024)
 

Functions

int netatalk_unlink (const char *name)
 system unlink with afp error code.
 
int netatalk_unlinkat (int dirfd, const char *name)
 
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
 
int netatalk_rmdir (int dirfd, const char *name)
 System rmdir with afp error code, but ENOENT is not an error.
 
int netatalk_rmdir_all_errors (int dirfd, const char *name)
 system rmdir with afp error code.
 
int setfilmode (const struct vol *vol, const char *name, mode_t mode, struct stat *st)
 
int dir_rx_set (mode_t mode)
 
int unix_rename (int sfd, const char *oldpath, int dfd, const char *newpath)
 This is equivalent of unix rename()
 
int copy_file (int sfd, const char *src, const char *dst, mode_t mode)
 
int copy_file_fd (int sfd, int dfd)
 
int copy_ea (const char *ea, int sfd, const char *src, const char *dst, mode_t mode)
 Copy an EA from one file to another.
 
void become_root (void)
 
void unbecome_root (void)
 
int gmem (gid_t gid, int ngroups, gid_t *groups)
 
int set_groups (AFPObj *obj, struct passwd *pwd)
 
const char * print_groups (int ngroups, gid_t *groups)
 

Macro Definition Documentation

◆ NETATALK_DIOSZ_HEAP

#define NETATALK_DIOSZ_HEAP   (1024*1024)

◆ NETATALK_DIOSZ_STACK

#define NETATALK_DIOSZ_STACK   65536

Function Documentation

◆ become_root()

void become_root ( void  )
extern

seteuid(0) and back, if either fails and panic != 0 we PANIC. Nesting is tracked: only the outermost become_root() elevates privileges and only the matching unbecome_root() drops them.

◆ copy_ea()

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

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 
)
extern

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

◆ copy_file_fd()

int copy_file_fd ( int  sfd,
int  dfd 
)
extern

Copy all file data from one file fd to another

◆ dir_rx_set()

int dir_rx_set ( mode_t  mode)
extern

◆ gmem()

int gmem ( gid_t  gid,
int  ngroups,
gid_t *  groups 
)
extern

◆ netatalk_rmdir()

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

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 
)
extern

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)
extern

system unlink with afp error code.

Note
ENOENT is not an error.

◆ netatalk_unlinkat()

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

at wrapper for netatalk_unlink

◆ opendirat()

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

opendir wrapper for *at semantics support

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

Parameters
[in]dirfdif != -1, chdir(dirfd) before opendir(path)
[in]pathpathname

◆ print_groups()

const char * print_groups ( int  ngroups,
gid_t *  groups 
)
extern

◆ set_groups()

int set_groups ( AFPObj obj,
struct passwd *  pwd 
)
extern

◆ setfilmode()

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

◆ statat()

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

stat/fsstatat multiplexer

statat mulitplexes stat and fstatat.

Parameters
[in]dirfd-1 gives AT_FDCWD
[in]pathpathname
[in,out]stpointer to struct stat

◆ unbecome_root()

void unbecome_root ( void  )
extern

◆ unix_rename()

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

This is equivalent of unix rename()

unix_rename mulitplexes rename and renameat.

Parameters
[in]sfd-1 gives AT_FDCWD
[in]oldpathguess what
[in]dfdsame as sfd
[in]newpathguess what