Platforms to show: All Mac Windows Linux Cross-Platform
Back to DarwinChmodMBS class.
DarwinChmodMBS.chflags(path as string, flags as Integer) as Integer
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Files | MBS MacCF Plugin | 3.1 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
The flags specified are formed by or'ing the following values
UF_NODUMP | 0x00000001 | Do not dump the file. |
UF_IMMUTABLE | 0x00000002 | The file may not be changed. |
UF_APPEND | 0x00000004 | The file may only be appended to. |
UF_OPAQUE | 0x00000008 | Directory is opaque wrt. union |
The ''UF_IMMUTABLE'' and ''UF_APPEND'' flags may be set or unset by either the owner of a file or the super-user.
The ''SF_IMMUTABLE'' and ''SF_APPEND'' flags may only be set or unset by the super-user. They may be set at any time, but normally may only be unset when the system is in single-user mode.
You can type "man 2 chflags" on the Mac OS X terminal for more details.
Upon successful completion, a value of 0 is returned. Otherwise, -1 is returned.
Returns -2 on bad parameter or if function is not available.
Chflags() will fail it:
ENOTDIR | A component of the path prefix is not a directory. |
ENAMETOOLONG | A component of a pathname exceeded {NAME_MAX} characters, or an entire path name exceeded {PATH_MAX} characters. |
ENOENT | The named file does not exist. |
EACCES | Search permission is denied for a component of the path prefix. |
ELOOP | Too many symbolic links were encountered in translating the pathname. |
EPERM | The effective user ID does not match the owner of the file and the effective user ID is not the super-user. |
EROFS | The named file resides on a read-only file system. |
EFAULT | Path points outside the process's allocated address space. |
EIO | An I/O error occurred while reading from or writing to the file system. |
DarwinChmodMBS.chmod(path as string, mode as Integer) as Integer
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Files | MBS MacCF Plugin | 3.1 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Chmod() verifies that the process owner (user) either owns the file specified by path (or fd), or is the super- user. A mode is created from or'd permission bit masks like this:
IRWXU | &o0000700 | RWX mask for owner |
IRUSR | &o0000400 | R for owner |
IWUSR | &o0000200 | W for owner |
IXUSR | &o0000100 | X for owner |
IRWXG | &o0000070 | RWX mask for group |
IRGRP | &o0000040 | R for group |
IWGRP | &o0000020 | W for group |
IXGRP | &o0000010 | X for group |
IRWXO | &o0000007 | RWX mask for other |
IROTH | &o0000004 | R for other |
IWOTH | &o0000002 | W for other |
IXOTH | &o0000001 | X for other |
ISUID | &o0004000 | set user id on execution |
ISGID | &o0002000 | set group id on execution |
ISVTX | &o0001000 | save swapped text even after use |
The ISVTX (the sticky bit) indicates to the system which executable files are shareable (the default) and the system maintains the program text of the files in the swap area. The sticky bit may only be set by the super user on shareable executable files.
If mode ISVTX (the 'sticky bit') is set on a directory, an unprivileged user may not delete or rename files of other users in that directory. The sticky bit may be set by any user on a directory which the user owns or has appropriate permissions. For more details of the properties of the sticky bit, see sticky(8).
Writing or changing the owner of a file turns off the set-user-id and set-group-id bits unless the user is the super-user. This makes the system somewhat more secure by protecting set-user-id (set-group-id) files from remaining set-user-id (set-group-id) if they are modified, at the expense of a degree of compatibility.
You can type "man 2 chmod" on the Mac OS X terminal for more details.
Upon successful completion, a value of 0 is returned. Otherwise, -1 is returned.
Returns -2 on bad parameter or if function is not available.
Chmod() will fail and the file mode will be unchanged if:
ENOTDIR | A component of the path prefix is not a directory. |
ENAMETOOLONG | A component of a pathname exceeded {NAME_MAX} characters, or an entire path name exceeded {PATH_MAX} characters. |
ENOENT | The named file does not exist. |
EACCES | Search permission is denied for a component of the path prefix. |
ELOOP | Too many symbolic links were encountered in translating the pathname. |
EPERM | The effective user ID does not match the owner of the file and the effective user ID is not the super-user. |
EROFS | The named file resides on a read-only file system. |
EFAULT | Path points outside the process's allocated address space. |
EIO | An I/O error occurred while reading from or writing to the file system. |
DarwinChmodMBS.chown(path as string, uid as Integer, gid as Integer) as Integer
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Files | MBS MacCF Plugin | 3.1 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
The owner of a file may change the group to a group of which he or she is a member, but the change owner capability is restricted to the superuser.
Chown() clears the set-user-id and set-group-id bits on the file to prevent accidental or mischievous creation of set-user-id and set-group-id programs.
You can type "man 2 chmod" on the Mac OS X terminal for more details.
Upon successful completion, a value of 0 is returned. Otherwise, -1 is returned.
Returns -2 on bad parameter or if function is not available.
Chown() will fail and the file or link will be unchanged if:
ENOTDIR | A component of the path prefix is not a directory. |
ENAMETOOLONG | A component of a pathname exceeded {NAME_MAX} characters, or an entire path name exceeded {PATH_MAX} characters. |
ENOENT | The named file does not exist. |
EACCES | Search permission is denied for a component of the path prefix. |
ELOOP | Too many symbolic links were encountered in translating the pathname. |
EPERM | The effective user ID is not the super-user. |
EROFS | The named file resides on a read-only file system. |
EFAULT | Path points outside the process's allocated addressspace. |
EIO | An I/O error occurred while reading from or writing to the file system. |
DarwinChmodMBS.error as Integer
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Files | MBS MacCF Plugin | 3.1 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
This function asks the operation system. It's not a property like in other classes.
Error codes:
EPERM | 1 | Operation not permitted |
ENOENT | 2 | No such file or directory |
ESRCH | 3 | No such process |
EINTR | 4 | Interrupted system call |
EIO | 5 | Input/output error |
ENXIO | 6 | Device not configured |
E2BIG | 7 | Argument list too long |
ENOEXEC | 8 | Exec format error |
EBADF | 9 | Bad file descriptor |
ECHILD | 10 | No child processes |
EDEADLK | 11 | Resource deadlock avoided (11 was EAGAIN) |
ENOMEM | 12 | Cannot allocate memory |
EACCES | 13 | Permission denied |
EFAULT | 14 | Bad address |
ENOTBLK | 15 | Block device required |
EBUSY | 16 | Device busy |
EEXIST | 17 | File exists |
EXDEV | 18 | Cross-device link |
ENODEV | 19 | Operation not supported by device |
ENOTDIR | 20 | Not a directory |
EISDIR | 21 | Is a directory |
EINVAL | 22 | Invalid argument |
ENFILE | 23 | Too many open files in system |
EMFILE | 24 | Too many open files |
ENOTTY | 25 | Inappropriate ioctl for device |
ETXTBSY | 26 | Text file busy |
EFBIG | 27 | File too large |
ENOSPC | 28 | No space left on device |
ESPIPE | 29 | Illegal seek |
EROFS | 30 | Read-only file system |
EMLINK | 31 | Too many links |
EPIPE | 32 | Broken pipe |
math software | ||
EDOM | 33 | Numerical argument out of domain |
ERANGE | 34 | Result too large |
non-blocking and interrupt i/o | ||
EAGAIN | 35 | Resource temporarily unavailable |
EWOULDBLOCK | EAGAIN | Operation would block |
EINPROGRESS | 36 | Operation now in progress |
EALREADY | 37 | Operation already in progress |
ipc/network software -- argument errors | ||
ENOTSOCK | 38 | Socket operation on non-socket |
EDESTADDRREQ | 39 | Destination address required |
EMSGSIZE | 40 | Message too long |
EPROTOTYPE | 41 | Protocol wrong type for socket |
ENOPROTOOPT | 42 | Protocol not available |
EPROTONOSUPPORT | 43 | Protocol not supported |
ESOCKTNOSUPPORT | 44 | Socket type not supported |
ENOTSUP | 45 | Operation not supported |
EOPNOTSUPP | ENOTSUP | Operation not supported |
EPFNOSUPPORT | 46 | Protocol family not supported |
EAFNOSUPPORT | 47 | Address family not supported by protocol family |
EADDRINUSE | 48 | Address already in use |
EADDRNOTAVAIL | 49 | Can't assign requested address |
ipc/network software -- operational errors | ||
ENETDOWN | 50 | Network is down |
ENETUNREACH | 51 | Network is unreachable |
ENETRESET | 52 | Network dropped connection on reset |
ECONNABORTED | 53 | Software caused connection abort |
ECONNRESET | 54 | Connection reset by peer |
ENOBUFS | 55 | No buffer space available |
EISCONN | 56 | Socket is already connected |
ENOTCONN | 57 | Socket is not connected |
ESHUTDOWN | 58 | Can't send after socket shutdown |
ETOOMANYREFS | 59 | Too many references: can't splice |
ETIMEDOUT | 60 | Operation timed out |
ECONNREFUSED | 61 | Connection refused |
ELOOP | 62 | Too many levels of symbolic links |
ENAMETOOLONG | 63 | File name too long |
should be rearranged | ||
EHOSTDOWN | 64 | Host is down |
EHOSTUNREACH | 65 | No route to host |
ENOTEMPTY | 66 | Directory not empty |
quotas & mush | ||
EPROCLIM | 67 | Too many processes |
EUSERS | 68 | Too many users |
EDQUOT | 69 | Disc quota exceeded |
Network File System | ||
ESTALE | 70 | Stale NFS file handle |
EREMOTE | 71 | Too many levels of remote in path |
EBADRPC | 72 | RPC struct is bad |
ERPCMISMATCH | 73 | RPC version wrong |
EPROGUNAVAIL | 74 | RPC prog. not avail |
EPROGMISMATCH | 75 | Program version wrong |
EPROCUNAVAIL | 76 | Bad procedure for program |
ENOLCK | 77 | No locks available |
ENOSYS | 78 | Function not implemented |
EFTYPE | 79 | Inappropriate file type or format |
EAUTH | 80 | Authentication error |
ENEEDAUTH | 81 | Need authenticator |
Intelligent device errors | ||
EPWROFF | 82 | Device power is off |
EDEVERR | 83 | Device error, e.g. paper out |
EOVERFLOW | 84 | Value too large to be stored in data type |
Program loading errors | ||
EBADEXEC | 85 | Bad executable |
EBADARCH | 86 | Bad CPU type in executable |
ESHLIBVERS | 87 | Shared library version mismatch |
EBADMACHO | 88 | Malformed Macho file |
ECANCELED | 89 | Operation canceled |
ELAST | 89 | Must be equal largest errno |
Returns -2 if function is not available.
DarwinChmodMBS.lstat(path as string) as Integer
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Files | MBS MacCF Plugin | 3.1 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
See stat for details.
DarwinChmodMBS.stat(path as string) as Integer
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Files | MBS MacCF Plugin | 3.1 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Read, write or execute permission of the named file is not required, but all directories listed in the path name leading to the file must be searchable.
Lstat() is like stat() except in the case where the named file is a symbolic link, in which case lstat() returns information about the link, while stat() returns information about the file the link references. Unlike other filesystem objects, symbolic links do not have an owner, group, access mode, times, etc. Instead, these attributes are taken from the directory that contains the link. The only attributes returned from an lstat() that refer to the symbolic link itself are the file type (S_IFLNK), size, blocks, and link count (always 1).
Information about the file is stored directly into the fields of the class if the function is successfull.
You can type "man 2 stat" on the Mac OS X terminal for more details.
Upon successful completion, a value of 0 is returned. Otherwise, -1 is returned.
Returns -2 on bad parameter or if function is not available.
Stat() and lstat() will fail if:
ENOTDIR | A component of the path prefix is not a directory. |
ENAMETOOLONG | A component of a pathname exceeded {NAME_MAX} characters, or an entire path name exceeded {PATH_MAX} characters. |
ENOENT | The named file does not exist. |
EACCES | Search permission is denied for a component of the path prefix. |
ELOOP | Too many symbolic links were encountered in translating the pathname. |
EFAULT | Sb or name points to an invalid address. |
EIO | An I/O error occurred while reading from or writing to the file system. |
The items on this page are in the following plugins: MBS MacCF Plugin.