檔案系統與掛載控制
掛載與卸載檔案系统
mount
SCML 支援的功能:
// Create a new mount
mount(
source, target, filesystemtype,
mountflags = 0,
data
);
// Move the existing mount point
mount(
source, target, filesystemtype,
mountflags = MS_MOVE,
data
);
// Create a bind mount
mount(
source, target, filesystemtype,
mountflags = MS_BIND | MS_REC,
data
);
Partially supported mount flags:
MS_RECis only effective when used in conjunction withMS_BINDMS_REMOUNTcan be used, but the set options have no actual effect.MS_DIRSYNCcan be set but have no actual effect.MS_LAZYTIMEcan be set but have no actual effect.MS_MANDLOCKcan be set but have no actual effect.MS_NOATIMEcan be set but have no actual effect.MS_NODEVcan be set but have no actual effect.MS_NODIRATIMEcan be set but have no actual effect.MS_NOEXECcan be set but have no actual effect.MS_NOSUIDcan be set but have no actual effect.MS_RDONLYcan be set but have no actual effect.MS_RELATIMEcan be set but have no actual effect.MS_SILENTcan be set but have no actual effect.MS_STRICTATIMEcan be set but have no actual effect.MS_SYNCHRONOUScan be set but have no actual effect.
未支援的掛載旗標:
MS_SHAREDMS_SLAVEMS_UNBINDABLE
For more information, see the man page.
umount and umount2
SCML 支援的功能:
// Unmount a mounted file system
umount(target);
// Unmount a mounted file system with enhanced behavior control
umount2(target, flags = UMOUNT_NOFOLLOW);
Silently-ignored flags:
MNT_FORCEMNT_DETACHMNT_EXPIRE
For more information, see the man page.
事件通知
inotify_init 和 inotify_init1
SCML 支援的功能:
// Create an inotify instance
inotify_init();
// Create an inotify instance with enhanced behavior control
inotify_init1(flags = IN_CLOEXEC | IN_NONBLOCK);
For more information, see the man page.
inotify_add_watch
SCML 支援的功能:
inotify_events = IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE |
IN_CLOSE_NOWRITE | IN_OPEN | IN_CREATE | IN_DELETE |
IN_DELETE_SELF | IN_CLOSE;
inotify_controls = IN_ONLYDIR | IN_DONT_FOLLOW | IN_MASK_CREATE |
IN_MASK_ADD | IN_ONESHOT;
// Add a watch to an initialized inotify instance
inotify_add_watch(fd, pathname, mask = <inotify_events> | <inotify_controls>);
未支援的事件旗標:
IN_MOVED_FROMandIN_MOVED_TO- Move events are not generatedIN_MOVE_SELF- Self move events are not generatedIN_UNMOUNT- Unmount events are not generatedIN_Q_OVERFLOW- Queue overflow events are not generated (events are silently dropped when queue is full)IN_ALL_EVENTS- Only includes actually supported events
未支援的控制旗標:
IN_EXCL_UNLINK- Events on unlinked files are not excluded
For more information, see the man page.