#endif
int rmdir(const char *);
int setgid(gid_t);
-#if !defined(__minix)
int setpgid(pid_t, pid_t);
-#endif /* !defined(__minix) */
pid_t setsid(void);
int setuid(uid_t);
unsigned int sleep(unsigned int);
ssize_t readlink(const char * __restrict, char * __restrict, size_t);
#endif
void *sbrk(intptr_t);
-#if !defined(__minix)
/* XXX prototype wrong! */
int setpgrp(pid_t, pid_t); /* obsoleted by setpgid() */
+#if !defined(__minix)
int setregid(gid_t, gid_t);
int setreuid(uid_t, uid_t);
#endif /* !defined(__minix) */
.PATH: ${ARCHDIR}/compat-43 ${.CURDIR}/compat-43
SRCS+= creat.c getdtablesize.c \
- killpg.c \
+ killpg.c setpgrp.c \
.if !defined(AUDIT)
SRCS+= getwd.c
sync.c syscall.c sysuname.c truncate.c umask.c unlink.c write.c \
utimensat.c utimes.c futimes.c lutimes.c futimens.c \
_exit.c _ucontext.c environ.c __getcwd.c vfork.c sizeup.c init.c \
- getrusage.c setrlimit.c
+ getrusage.c setrlimit.c setpgid.c
# Minix specific syscalls / utils.
SRCS+= cprofile.c sprofile.c stack_utils.c _mcontext.c
--- /dev/null
+#include <sys/cdefs.h>
+#include <lib.h>
+#include "namespace.h"
+
+#include <string.h>
+
+#include <unistd.h>
+
+/*
+ * "Smart" stub for now. This requires job control to be properly implemented.
+ */
+int setpgid(pid_t pid, pid_t pgid)
+{
+ pid_t _pid, _pgid, sid, cpid;
+
+ _pid = pid;
+ _pgid = pgid;
+
+ /* Who are we? */
+ cpid = getpid();
+
+ /* if zero, means current process. */
+ if (_pid == 0) {
+ _pid = cpid;
+ }
+
+ /* if zero, means given pid. */
+ if (_pgid == 0) {
+ _pgid = _pid;
+ }
+
+ /* right now we only support the equivalent of setsid(), which is
+ * setpgid(0,0) */
+ if ((_pid != cpid) || (_pgid != cpid)) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ if (setsid() == cpid) {
+ return 0;
+ } else {
+ return -1;
+ }
+}