Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 14 Oct 2006 10:21:28 GMT
From:      Roman Divacky <rdivacky@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 107871 for review
Message-ID:  <200610141021.k9EALS8d069991@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=107871

Change 107871 by rdivacky@rdivacky_witten on 2006/10/14 10:20:41

	Partially implement prctl() syscall.

Affected files ...

.. //depot/projects/linuxolator/src/sys/compat/linux/linux_misc.c#7 edit
.. //depot/projects/linuxolator/src/sys/compat/linux/linux_misc.h#1 add

Differences ...

==== //depot/projects/linuxolator/src/sys/compat/linux/linux_misc.c#7 (text+ko) ====

@@ -1549,4 +1549,33 @@
 int
 linux_prctl(struct thread *td, struct linux_prctl_args *args)
 {
+   	int error = 0;
+	struct proc *p = td->td_proc;
+	char comm[LINUX_MAX_COMM_LEN];
+   	
+   	switch (args->options) {
+	   	case LINUX_PR_SET_PDEATHSIG:
+		   	if (!LINUX_SIG_VALID(args->arg2))
+			   	return (EINVAL);
+			PROC_LOCK(p);
+			p->p_sigparent = args->arg2;
+			PROC_UNLOCK(p);
+		   	break;
+		case LINUX_PR_GET_PDEATHSIG:
+			error = copyout(&p->p_sigparent, (void *) args->arg2, sizeof(p->p_sigparent));
+			break;
+		case LINUX_PR_SET_NAME:
+			comm[LINUX_MAX_COMM_LEN-1] = 0;
+			error = copyin(comm, (void *) args->arg2, LINUX_MAX_COMM_LEN-1);
+			if (error)
+			   	return (error);
+			/* XXX: no locking needed? */
+			strcpy(p->p_comm, comm);
+			break;
+		case LINUX_PR_GET_NAME:
+			error = copyout(&p->p_comm, (void *) args->arg2, MAXCOMLEN+1);
+			break;
+	}
+
+	return (error);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200610141021.k9EALS8d069991>