Unison Help
- 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.3.chmod() #
NAME
chmod – change access permission mode of file
SYNOPSIS
#include <sys/types.h>
#include <sys/stat.h>
- int chmod(const char *path , mode_t mode );
DESCRIPTION
chmod() sets the access permission portion of the mode of the file whose name is given by path to the bit pattern contained in mode . Modes are constructed by ORing the access permission bits.
The effective user ID of the thread must match the owner of the file or the thread must have the appropriate privilege to change the mode of a file.
If the thread is not privileged and the file is not a directory, mode bit 01000 (save text image on execution) is cleared.
If a directory is writable and has S_ISVTX (the sticky bit) set, files within that directory can be removed or renamed only if one or more of the following is true (see unlink (2) and rename (2)):
(bu the user owns the file (bu the user owns the directory (bu the file is writable by the user (bu the user is a privileged user
If a directory has the set group ID bit set, a given file created within that directory will have the same group ID as the directory, if that group ID is part of the group ID set of the thread that created the file. Otherwise, the newly created file’s group ID will be set to the effective group ID of the creating thread.
If the mode bit 02000 (set group IDon execution) is set and the mode bit 00010 (execute or search by group) is not set, mandatory file/record locking will exist on a regular file. This may affect future calls to open (2), creat (2), read (2), and write (2) on this file.
Upon successful completion, chmod() marks for update the st_ctime field of the file.
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
This function is a member 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 this function.
chmod() will fail and the file mode will be unchanged if one or more of the following are true:
- EACCES
- Search permission is denied on a component of the path prefix of
- EFAULT
- path points to an illegal address.
- EIO
- An I/O error occurred while reading from or writing to the file system.
- EMULTIHOP
- Components of path require hopping to multiple remote machines and file system type 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
- Either a component of the path prefix, or the file referred to by path does not exist or is a null pathname.
- ENOLINK
- fildes points to a remote machine and the link to that machine is no longer active.
- ENOTDIR
- A component of the prefix of path is not a directory.
- EPERM
- The effective user ID does not match the owner of the file and is not super-user.
- EROFS
- The file referred to by path resides on a read-only file system.