@@ -196,4 +196,94 @@ static inline abi_long do_bsd_setrlimit(abi_long arg1, abi_ulong arg2)
return ret;
}
+/* getpid(2) */
+static inline abi_long do_bsd_getpid(void)
+{
+ return get_errno(getpid());
+}
+
+/* getppid(2) */
+static inline abi_long do_bsd_getppid(void)
+{
+ return get_errno(getppid());
+}
+
+/* getuid(2) */
+static inline abi_long do_bsd_getuid(void)
+{
+ return get_errno(getuid());
+}
+
+/* geteuid(2) */
+static inline abi_long do_bsd_geteuid(void)
+{
+ return get_errno(geteuid());
+}
+
+/* getgid(2) */
+static inline abi_long do_bsd_getgid(void)
+{
+ return get_errno(getgid());
+}
+
+/* getegid(2) */
+static inline abi_long do_bsd_getegid(void)
+{
+ return get_errno(getegid());
+}
+
+/* setuid(2) */
+static inline abi_long do_bsd_setuid(abi_long arg1)
+{
+ return get_errno(setuid(arg1));
+}
+
+/* seteuid(2) */
+static inline abi_long do_bsd_seteuid(abi_long arg1)
+{
+ return get_errno(seteuid(arg1));
+}
+
+/* setgid(2) */
+static inline abi_long do_bsd_setgid(abi_long arg1)
+{
+ return get_errno(setgid(arg1));
+}
+
+/* setegid(2) */
+static inline abi_long do_bsd_setegid(abi_long arg1)
+{
+ return get_errno(setegid(arg1));
+}
+
+/* getpgid(2) */
+static inline abi_long do_bsd_getpgid(pid_t pid)
+{
+ return get_errno(getpgid(pid));
+}
+
+/* setpgid(2) */
+static inline abi_long do_bsd_setpgid(int pid, int pgrp)
+{
+ return get_errno(setpgid(pid, pgrp));
+}
+
+/* getpgrp(2) */
+static inline abi_long do_bsd_getpgrp(void)
+{
+ return get_errno(getpgrp());
+}
+
+/* setreuid(2) */
+static inline abi_long do_bsd_setreuid(abi_long arg1, abi_long arg2)
+{
+ return get_errno(setreuid(arg1, arg2));
+}
+
+/* setregid(2) */
+static inline abi_long do_bsd_setregid(abi_long arg1, abi_long arg2)
+{
+ return get_errno(setregid(arg1, arg2));
+}
+
#endif /* !BSD_PROC_H_ */
@@ -255,6 +255,66 @@ static abi_long freebsd_syscall(void *cpu_env, int num, abi_long arg1,
ret = do_bsd_setrlimit(arg1, arg2);
break;
+ case TARGET_FREEBSD_NR_getpid: /* getpid(2) */
+ ret = do_bsd_getpid();
+ break;
+
+ case TARGET_FREEBSD_NR_getppid: /* getppid(2) */
+ ret = do_bsd_getppid();
+ break;
+
+ case TARGET_FREEBSD_NR_getuid: /* getuid(2) */
+ ret = do_bsd_getuid();
+ break;
+
+ case TARGET_FREEBSD_NR_geteuid: /* geteuid(2) */
+ ret = do_bsd_geteuid();
+ break;
+
+ case TARGET_FREEBSD_NR_getgid: /* getgid(2) */
+ ret = do_bsd_getgid();
+ break;
+
+ case TARGET_FREEBSD_NR_getegid: /* getegid(2) */
+ ret = do_bsd_getegid();
+ break;
+
+ case TARGET_FREEBSD_NR_setuid: /* setuid(2) */
+ ret = do_bsd_setuid(arg1);
+ break;
+
+ case TARGET_FREEBSD_NR_seteuid: /* seteuid(2) */
+ ret = do_bsd_seteuid(arg1);
+ break;
+
+ case TARGET_FREEBSD_NR_setgid: /* setgid(2) */
+ ret = do_bsd_setgid(arg1);
+ break;
+
+ case TARGET_FREEBSD_NR_setegid: /* setegid(2) */
+ ret = do_bsd_setegid(arg1);
+ break;
+
+ case TARGET_FREEBSD_NR_getpgrp: /* getpgrp(2) */
+ ret = do_bsd_getpgrp();
+ break;
+
+ case TARGET_FREEBSD_NR_getpgid: /* getpgid(2) */
+ ret = do_bsd_getpgid(arg1);
+ break;
+
+ case TARGET_FREEBSD_NR_setpgid: /* setpgid(2) */
+ ret = do_bsd_setpgid(arg1, arg2);
+ break;
+
+ case TARGET_FREEBSD_NR_setreuid: /* setreuid(2) */
+ ret = do_bsd_setreuid(arg1, arg2);
+ break;
+
+ case TARGET_FREEBSD_NR_setregid: /* setregid(2) */
+ ret = do_bsd_setregid(arg1, arg2);
+ break;
+
/*
* File system calls.