如何添加像命令行函数setfattr -n user.custom_attrib -v 99 ex1.txt这样的扩展属性,但在内核中的自定义系统调用中进行添加。我已经看过了linux/xattrib.h,但我没有运气尝试从内核空间设置任何东西。每当我使用vfs_setxattr(struct dentry *, const char *, const void *, size_t, int);它时,它都会重新启动整个 VM。最后,我尝试添加一个新的整数类型作为文件的扩展属性,我还需要检索该扩展属性。我需要使用内核空间中允许的函数。
useDelimiter不会识别竖条,但会识别其他字符.
这不起作用:
scan.useDelimiter("|");
Run Code Online (Sandbox Code Playgroud)
这确实有效:
scan.useDelimiter(",");
Run Code Online (Sandbox Code Playgroud)
其余代码:
Scanner scan = new Scanner("12,d, |, f | ");
// initialize the string delimiter
scan.useDelimiter(",");
// Printing the delimiter used
System.out.println("The delimiter use is "+scan.delimiter());
// Printing the tokenized Strings
while(scan.hasNext()){
System.out.print(scan.next());
}
// closing the scanner stream
scan.close();
Run Code Online (Sandbox Code Playgroud)