do not edit — generated by btf.
git.druid.rocksindexdruid520kaboomsrc/user/mkdir.nsc

src/user/mkdir.nsc


include "syscalls.nsh";
include "lib.nsh";
include "string.nsh";
include "stdio.nsh";
 
/* one arg, no -p/-m -- minimalized, matching the rest of this
 * kernel's coreutils. always creates with rwx (7) -- chmod after the
 * fact if something more restrictive is actually wanted; kfs.nsc does
 * enforce these now (r=list, w=create/remove entries within, x=cd/
 * traverse into, for a directory). */
global i32
main(i32 argc, ptr argv)
{
	ptr name;
	u64 name_len;
 
	if(argc < 2)
	{
		fputs(2, "usage: mkdir name\n");
		return 1;
	}
 
	name = argv_get(argv, 1);
	name_len = strlen(name);
	if(sys_mkdir(name, name_len, (u64)7) < 0)
	{
		print_err(2, "mkdir", "failed");
		return 1;
	}
	return 0;
}
powered by btf.