mirror of
https://github.com/uselessd/alcove.git
synced 2026-04-15 09:15:19 +00:00
Add getcwd(3)
This commit is contained in:
@@ -254,6 +254,7 @@ specs() ->
|
||||
-spec chdir(port(),iodata()) -> 'ok' | {'error', file:posix()}.
|
||||
-spec chroot(port(),iodata()) -> 'ok' | {'error', file:posix()}.
|
||||
-spec execvp(port(),iodata(),iodata()) -> 'ok'.
|
||||
-spec getcwd(port()) -> {'ok', binary()} | {'error', file:posix()}.
|
||||
-spec getgid(port()) -> non_neg_integer().
|
||||
-spec getrlimit(port(),non_neg_integer()) -> {'ok', #rlimit{}} | {'error', file:posix()}.
|
||||
-spec getuid(port()) -> non_neg_integer().
|
||||
|
||||
@@ -170,6 +170,21 @@ BADARG:
|
||||
return erl_mk_atom("badarg");
|
||||
}
|
||||
|
||||
/*
|
||||
* getcwd(3)
|
||||
*
|
||||
*/
|
||||
static ETERM *
|
||||
alcove_getcwd(ETERM *arg)
|
||||
{
|
||||
char buf[PATH_MAX] = {0};
|
||||
|
||||
if (!getcwd(buf, sizeof(buf)))
|
||||
return alcove_errno(errno);
|
||||
|
||||
return alcove_ok(erl_mk_binary(buf, strlen(buf)));
|
||||
}
|
||||
|
||||
/*
|
||||
* getgid(2)
|
||||
*
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
chdir/1
|
||||
chroot/1
|
||||
execvp/2
|
||||
getcwd/0
|
||||
getgid/0
|
||||
getrlimit/1
|
||||
getuid/0
|
||||
|
||||
Reference in New Issue
Block a user