Unison Help
![](https://rowebots.com/wp-content/plugins/documentor/skins/default/images/search.png)
- Unison Kernel
- Pthreads
- pthread_create()
- pthread_exit()
- pthread_self()
- pthread_equal()
- pthread_join()
- pthread_detach()
- pthread_setschedparam()
- pthread_getschedparam()
- pthread_attr_init()
- pthread_attr_destroy()
- pthread_attr_setstackaddr()
- pthread_attr_getstackaddr()
- pthread_attr_setstacksize()
- pthread_attr_getstacksize()
- pthread_attr_setschedparam()
- pthread_attr_getschedparam()
- pthread_attr_setdetachstate()
- pthread_attr_getdetachstate()
- pthread_stackinfo()
- pthread_setprio()
- pthread_getprio()
- sched_get_priority_max()
- sched_get_priority_min()
- sched_yield()
- Pthread Cancellation
- Mutex
- Semaphores
- Message Queues
- Conditional Variables
- Barriers
- Timers
- Clocks
- Memory Allocation
- Rendezvous
- Interrupts
- Directory Services
- Miscellaneous
- Pthreads
- Unison I/O Library
- Unison STDIO Library
- STDIO Library Calls
- clearerr()
- dprintf()
- fclose()
- fdopen()
- feof()
- ferror()
- fileno()
- fflush()
- fgetc()
- fgetpos()
- fgets()
- fopen()
- fprintf()
- fputc()
- fputs()
- fread()
- freopen()
- fscanf()
- fseek()
- fseeko()
- fsetpos()
- ftell()
- ftello()
- fwrite()
- getc()
- getc_unlocked()
- getchar()
- getchar_unlocked()
- getdelim()
- getline()
- gets()
- get_stderr_ptr()
- get_stdin_ptr()
- get_stdout_ptr()
- noperprintf()
- perprintf()
- perror()
- posix_compat()
- printf()
- putc()
- putc_unlocked()
- putchar()
- putchar_unlocked()
- puts()
- remove()
- rewind()
- scanf()
- setbuf()
- setvbuf()
- snprintf()
- sprintf()
- sscanf()
- stderr_init()
- stderr_close()
- stdin_init()
- stdin_close()
- stdout_init()
- stdout_close()
- vdprintf()
- vscanf()
- vsscanf()
- vfscanf()
- vprintf()
- vsnprintf()
- vsprintf()
- vfprintf()
- ungetc()
- Do-nothing Stubs
- STDIO Library Calls
- Unison LIBC Library
- Unison I/O Servers
- Graphics, Camera, Video, Audio
- Network Protocols
- TCP and UDP Server - tcpd
- DHCP Client Service - dhcp client
- DHCP Server - dhcpd
- Telnet Server - telnetd
- Tiny FTP Server - tftpd
- Point to Point - pppd
- Network Translation - NAT with PAT
- Firewall
- Tiny HTTP Server - thttpd
- Tiny HTTP Server with TLS
- POP3 Server
- Simple Mail Transfer Protocol Services (SMTP)
- Bootp Protocol
- File Transfer Protocol Server (FTP)
- File Transfer Client Services
- RPC / XDR
- DNS Client
- HTTP/HTTPS Client
- REST Client
- AutoIP Service - autoip client
- mDNS server - mdnsd
- SNTP Client
- SNMP Agent - Snmpd server
- SSL/TLS library
- SSH server
- IP security
- Power Control
- Serial I/O
- System Services
- Universal Serial Bus (USB)
- Wireless
- Remedy Tools for Unison
2.31.stat() #
NAME
stat – get file status
SYNOPSIS
#include <sys/stat.h>
- int stat(const char *path , struct stat *buf );
- int fstat(int fildes , struct stat *buf );
DESCRIPTION
The stat() function obtains information about the named file and write it to the area pointed to by the buf argument. The path argument points to a pathname naming a file. All directories listed in the path name leading to the file must be searchable.
The fstat() function obtains information about an open file associated with the file descriptor fildes, and writes it to the area pointed to by buf.
The buf argument is a pointer to a stat structure into which information is placed concerning the file.
The contents of the structure pointed to by buf include the following members:
mode_t st_mode; /* File mode */ ino_t st_ino; /* Inode number */ dev_t st_dev; /* ID of device containing */ /* a directory entry for this file */ dev_t st_rdev; /* ID of device */ /* This entry is defined only for */ /* char special or block special files */ nlink_t st_nlink; /* Number of links */ uid_t st_uid; /* User ID of the file's owner */ gid_t st_gid; /* Group ID of the file's group */ off_t st_size; /* File size in bytes */ time_t st_atime; /* Time of last access */ time_t st_mtime; /* Time of last data modification */ time_t st_ctime; /* Time of last file status change */ /* Times measured in seconds since */ /* 00:00:00 UTC, Jan. 1, 1970 */ long st_blksize; /* Preferred I/O block size */ long st_blocks; /* Number st_blksize blocks allocated */
- st_mode
- The mode of the file specifies both the permissions to use and the type of node to be created. It should be a combination (using bitwise OR) of one of the file types and the permissions for the node.
- The file type and the permissions are specified in stat.h. The permissions of the created node are (mode & ~umask). Symbolic links are not supported so the mode of a file may not be S_IFLNK.
- st_ino
- This field uniquely identifies the file in a given file system. The pair st_ino and st_dev uniquely identifies regular files.
- st_dev
- This field uniquely identifies the file system that contains the file. Its value may be used as input to the ustat() function to determine more information about this file system. No other meaning is associated with this value.
- st_rdev
- This field should be used only by administrative commands. It is valid only for block special or character special files and only has meaning on the system where the file was configured.
- st_nlink
- This field should be used only by administrative commands.
- st_uid
- The user ID of the file’s owner.
- st_gid
- The group ID of the file’s group.
- st_size
- For regular files, this is the address of the end of the file. For block special or character special, this is not defined.
- st_atime
- Time when file data was last accessed. Changed by the following function: read .
- st_mtime
- Time when data was last modified. Changed by the following function: write .
- st_ctime
- Time when file status was last changed. Changed by the following functions: chmod(), link(), unlink(), and write().
- st_blksize
- A hint as to the “best” unit size for I/O operations. This field is not defined for block-special or character-special files.
- st_blocks
- The total number of physical blocks of size 512 bytes actually allocated on disk. This field is not defined for block-special or character-special files.
RETURN VALUES
Upon successful completion a value of 0 is returned. Otherwise, a value of -1 is returned and errno is set to indicate the error.
ERRORS
These functions are members of Unison’s IOLIB family of functions. IOLIB is implemented as a message passing and generalized interface layer. Each Unison I/O server is responsible for its own error reporting.
For an exact list of error codes returned by a particular server, refer to that server’s documentation in the Unison Programmer’s Guide for each specific platform.
Servers may implement these errors codes in response to these functions.
stat() fails if one or more of the following are true:
- EACCES
- Search permission is denied for a component of the path prefix.
- EFAULT
- buf or path points to an illegal address.
- EMULTIHOP
- Components of path require hopping to multiple remote machines and the file system does not allow it.
- ENAMETOOLONG
- The length of the path argument exceeds {PATH_MAX}, or the length of a path component exceeds {NAME_MAX} while {_POSIX_NO_TRUNC} is in effect.
- ENOENT
- The named file does not exist or is the null pathname.
- ENOLINK
- path points to a remote machine and the link to that machine is no longer active.
- ENOTDIR
- A component of the path prefix is not a directory.