mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 13:52:28 +00:00
Add lchown, lchmod, statvfs, fstatvfs
This commit is contained in:
parent
7b74f6e20e
commit
5a632cf72d
24 changed files with 231 additions and 32 deletions
17
third_party/lua/lunix.c
vendored
17
third_party/lua/lunix.c
vendored
|
@ -2237,9 +2237,12 @@ static int LuaUnixStatfsFfree(lua_State *L) {
|
|||
}
|
||||
|
||||
// unix.Statfs:fsid()
|
||||
// └─→ fsid:int
|
||||
// └─→ x:int, y:int
|
||||
static int LuaUnixStatfsFsid(lua_State *L) {
|
||||
return ReturnInteger(L, GetUnixStatfs(L)->f_fsid);
|
||||
struct statfs *f = GetUnixStatfs(L);
|
||||
lua_pushinteger(L, f->f_fsid.__val[0]);
|
||||
lua_pushinteger(L, f->f_fsid.__val[1]);
|
||||
return 2;
|
||||
}
|
||||
|
||||
// unix.Statfs:namelen()
|
||||
|
@ -2314,10 +2317,14 @@ static int LuaUnixStatfsToString(lua_State *L) {
|
|||
FormatInt64(ibuf, f->f_ffree);
|
||||
luaL_addstring(&b, ibuf);
|
||||
}
|
||||
if (f->f_fsid) {
|
||||
luaL_addstring(&b, ", fsid=");
|
||||
FormatUint64(ibuf, f->f_fsid);
|
||||
if (f->f_fsid.__val[0] || f->f_fsid.__val[1]) {
|
||||
luaL_addstring(&b, ", fsid={");
|
||||
FormatUint64(ibuf, f->f_fsid.__val[0]);
|
||||
luaL_addstring(&b, ibuf);
|
||||
luaL_addstring(&b, ", ");
|
||||
FormatUint64(ibuf, f->f_fsid.__val[1]);
|
||||
luaL_addstring(&b, ibuf);
|
||||
luaL_addstring(&b, "}");
|
||||
}
|
||||
if (f->f_namelen) {
|
||||
luaL_addstring(&b, ", namelen=");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue