Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 25 Nov 2006 16:02:15 GMT
From:      Alexander Leidinger <netchild@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 110520 for review
Message-ID:  <200611251602.kAPG2FO2004368@repoman.freebsd.org>

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

Change 110520 by netchild@netchild_magellan on 2006/11/25 16:02:09

	semi-automatic style(9)
	Discussed with:	bde

Affected files ...

.. //depot/projects/linuxolator/src/sys/compat/linux/linux_misc.c#39 edit
.. //depot/projects/linuxolator/src/sys/compat/linux/linux_misc.h#3 edit

Differences ...

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

@@ -152,7 +152,7 @@
 	sysinfo.bufferram = 0;
 
 	swap_pager_status(&i, &j);
-	sysinfo.totalswap= i * PAGE_SIZE;
+	sysinfo.totalswap = i * PAGE_SIZE;
 	sysinfo.freeswap = (i - j) * PAGE_SIZE;
 
 	sysinfo.procs = nprocs;
@@ -186,7 +186,7 @@
 	error = kern_setitimer(td, ITIMER_REAL, &it, &old_it);
 	if (error)
 		return (error);
-	if (timevalisset(&old_it.it_value)) {		
+	if (timevalisset(&old_it.it_value)) {
 		if (old_it.it_value.tv_usec != 0)
 			old_it.it_value.tv_sec++;
 		td->td_retval[0] = old_it.it_value.tv_sec;
@@ -209,7 +209,7 @@
 #endif
 	old = (vm_offset_t)vm->vm_daddr + ctob(vm->vm_dsize);
 	new = (vm_offset_t)args->dsend;
-	tmp.nsize = (char *) new;
+	tmp.nsize = (char *)new;
 	if (((caddr_t)new > vm->vm_daddr) && !obreak(td, &tmp))
 		td->td_retval[0] = (long)new;
 	else
@@ -327,10 +327,10 @@
 
 	/* Set file/virtual offset based on a.out variant. */
 	switch ((int)(a_out->a_magic & 0xffff)) {
-	case 0413:	/* ZMAGIC */
+	case 0413:			/* ZMAGIC */
 		file_offset = 1024;
 		break;
-	case 0314:	/* QMAGIC */
+	case 0314:			/* QMAGIC */
 		file_offset = 0;
 		break;
 	default:
@@ -440,8 +440,8 @@
 			goto cleanup;
 	}
 #ifdef DEBUG
-	printf("mem=%08lx = %08lx %08lx\n", (long)vmaddr, ((long*)vmaddr)[0],
-	    ((long*)vmaddr)[1]);
+	printf("mem=%08lx = %08lx %08lx\n", (long)vmaddr, ((long *)vmaddr)[0],
+	    ((long *)vmaddr)[1]);
 #endif
 	if (bss_size != 0) {
 		/* Calculate BSS start address */
@@ -644,13 +644,13 @@
 }
 
 struct l_times_argv {
-	l_long		tms_utime;
-	l_long		tms_stime;
-	l_long		tms_cutime;
-	l_long		tms_cstime;
+	l_long	tms_utime;
+	l_long	tms_stime;
+	l_long	tms_cutime;
+	l_long	tms_cstime;
 };
 
-#define CLK_TCK 100	/* Linux uses 100 */
+#define CLK_TCK 100			/* Linux uses 100 */
 
 #define CONVTCK(r)	(r.tv_sec * CLK_TCK + r.tv_usec / (1000000 / CLK_TCK))
 
@@ -718,6 +718,7 @@
 #ifdef __i386__
 	{
 		const char *class;
+
 		switch (cpu_class) {
 		case CPUCLASS_686:
 			class = "i686";
@@ -799,12 +800,12 @@
 		printf(ARGS(waitpid, "%d, %p, %d"),
 		    args->pid, (void *)args->status, args->options);
 #endif
-	/* 
-	 * this is necessary because the test in kern_wait doesnt
-	 * work because we mess with the options here
+	/*
+	 * this is necessary because the test in kern_wait doesnt work
+	 * because we mess with the options here
 	 */
-	if (args->options &~ (WUNTRACED|WNOHANG|WCONTINUED|__WCLONE))
-	   	return (EINVAL);
+	if (args->options & ~(WUNTRACED | WNOHANG | WCONTINUED | __WCLONE))
+		return (EINVAL);
 
 	options = (args->options & (WNOHANG | WUNTRACED));
 	/* WLINUXCLONE should be equal to __WCLONE, but we make sure */
@@ -1010,10 +1011,10 @@
 int
 linux_nice(struct thread *td, struct linux_nice_args *args)
 {
-	struct setpriority_args	bsd_args;
+	struct setpriority_args bsd_args;
 
 	bsd_args.which = PRIO_PROCESS;
-	bsd_args.who = 0;	/* current process */
+	bsd_args.who = 0;		/* current process */
 	bsd_args.prio = args->inc;
 	return setpriority(td, &bsd_args);
 }
@@ -1061,8 +1062,7 @@
 			bsd_gidset[ngrp + 1] = linux_gidset[ngrp];
 			ngrp--;
 		}
-	}
-	else
+	} else
 		newcred->cr_ngroups = 1;
 
 	setsugid(p);
@@ -1137,12 +1137,12 @@
 	if (error)
 		return (error);
 
-	/* 
-	 * the 1024*1024 is a hardcoded constant of max files
-	 * per proc in linux
+	/*
+	 * the 1024*1024 is a hardcoded constant of max files per proc in
+	 * linux
 	 */
-	if (which == RLIMIT_NOFILE && rlim.rlim_max > (1024*1024))
-	   	return (EPERM);
+	if (which == RLIMIT_NOFILE && rlim.rlim_max > (1024 * 1024))
+		return (EPERM);
 
 	bsd_rlim.rlim_cur = (rlim_t)rlim.rlim_cur;
 	bsd_rlim.rlim_max = (rlim_t)rlim.rlim_max;
@@ -1406,7 +1406,7 @@
 int
 linux_getpid(struct thread *td, struct linux_getpid_args *args)
 {
-   	struct linux_emuldata *em;
+	struct linux_emuldata *em;
 
 #ifdef DEBUG
 	if (ldebug(getpid))
@@ -1414,12 +1414,12 @@
 #endif
 
 	if (linux_use26(td)) {
-   	   	em = em_find(td->td_proc, EMUL_UNLOCKED);
+		em = em_find(td->td_proc, EMUL_UNLOCKED);
 		KASSERT(em != NULL, ("getpid: emuldata not found.\n"));
-   		td->td_retval[0] = em->shared->group_pid;
+		td->td_retval[0] = em->shared->group_pid;
 		EMUL_UNLOCK(&emul_lock);
 	} else {
-   	   	td->td_retval[0] = td->td_proc->p_pid;
+		td->td_retval[0] = td->td_proc->p_pid;
 	}
 
 	return (0);
@@ -1441,7 +1441,7 @@
 int
 linux_getppid(struct thread *td, struct linux_getppid_args *args)
 {
-   	struct linux_emuldata *em;
+	struct linux_emuldata *em;
 	struct proc *p, *pp;
 
 #ifdef DEBUG
@@ -1450,9 +1450,9 @@
 #endif
 
 	if (!linux_use26(td)) {
-	   	PROC_LOCK(td->td_proc);
-	   	td->td_retval[0] = td->td_proc->p_pptr->p_pid;
-	   	PROC_UNLOCK(td->td_proc);
+		PROC_LOCK(td->td_proc);
+		td->td_retval[0] = td->td_proc->p_pptr->p_pid;
+		PROC_UNLOCK(td->td_proc);
 		return (0);
 	}
 
@@ -1463,28 +1463,27 @@
 	/* find the group leader */
 	p = pfind(em->shared->group_pid);
 
- 	/* lets pretend we were reparented to init */
- 	if (p == NULL) {
+	/* lets pretend we were reparented to init */
+	if (p == NULL) {
 #ifdef DEBUG
-	   	printf("getppid: thread group leader not found.\n");
+		printf("getppid: thread group leader not found.\n");
 #endif
- 		td->td_retval[0] = 1;
- 		EMUL_UNLOCK(&emul_lock);
- 		return (0);
-       }
-
-	pp = p->p_pptr;		/* switch to parent */
+		td->td_retval[0] = 1;
+		EMUL_UNLOCK(&emul_lock);
+		return (0);
+	}
+	pp = p->p_pptr;			/* switch to parent */
 	PROC_LOCK(pp);
 	PROC_UNLOCK(p);
 
 	/* if its also linux process */
 	if (pp->p_sysent == &elf_linux_sysvec) {
-   	   	em = em_find(pp, EMUL_LOCKED);
+		em = em_find(pp, EMUL_LOCKED);
 		KASSERT(em != NULL, ("getppid: parent emuldata not found.\n"));
 
 		td->td_retval[0] = em->shared->group_pid;
 	} else
-	   	td->td_retval[0] = pp->p_pid;
+		td->td_retval[0] = pp->p_pid;
 
 	EMUL_UNLOCK(&emul_lock);
 	PROC_UNLOCK(pp);
@@ -1543,7 +1542,7 @@
 int
 linux_getpriority(struct thread *td, struct linux_getpriority_args *args)
 {
-	struct getpriority_args	bsd_args;
+	struct getpriority_args bsd_args;
 	int error;
 
 #ifdef DEBUG
@@ -1570,14 +1569,14 @@
 
 	name[0] = CTL_KERN;
 	name[1] = KERN_HOSTNAME;
-	return (userland_sysctl(td, name, 2, 0, 0, 0, args->hostname, 
-		 args->len, 0, 0));
+	return (userland_sysctl(td, name, 2, 0, 0, 0, args->hostname,
+	    args->len, 0, 0));
 }
 
 int
 linux_exit_group(struct thread *td, struct linux_exit_group_args *args)
 {
-   	struct linux_emuldata *em, *td_em, *tmp_em;
+	struct linux_emuldata *em, *td_em, *tmp_em;
 	struct proc *sp;
 
 #ifdef DEBUG
@@ -1586,14 +1585,14 @@
 #endif
 
 	if (linux_use26(td)) {
-   	   	td_em = em_find(td->td_proc, EMUL_UNLOCKED);
+		td_em = em_find(td->td_proc, EMUL_UNLOCKED);
 
 		KASSERT(td_em != NULL, ("exit_group: emuldata not found.\n"));
 
-   		EMUL_SHARED_RLOCK(&emul_shared_lock);
-     		LIST_FOREACH_SAFE(em, &td_em->shared->threads, threads, tmp_em) {
-	   		if (em->pid == td_em->pid)
-		   		continue;
+		EMUL_SHARED_RLOCK(&emul_shared_lock);
+		LIST_FOREACH_SAFE(em, &td_em->shared->threads, threads, tmp_em) {
+			if (em->pid == td_em->pid)
+				continue;
 
 			sp = pfind(em->pid);
 			psignal(sp, SIGKILL);
@@ -1601,21 +1600,20 @@
 #ifdef DEBUG
 			printf(LMSG("linux_sys_exit_group: kill PID %d\n"), em->pid);
 #endif
-		}	
+		}
 
 		EMUL_SHARED_RUNLOCK(&emul_shared_lock);
 		EMUL_UNLOCK(&emul_lock);
 	}
+	exit1(td, W_EXITCODE(args->error_code, 0));
 
-	exit1(td, W_EXITCODE(args->error_code,0));
-
-   	return (0);
+	return (0);
 }
 
 int
 linux_prctl(struct thread *td, struct linux_prctl_args *args)
 {
-   	int error = 0, max_size;
+	int error = 0, max_size;
 	struct proc *p = td->td_proc;
 	char comm[LINUX_MAX_COMM_LEN];
 	struct linux_emuldata *em;
@@ -1625,22 +1623,22 @@
 		printf(ARGS(prctl, "%d, %d, %d, %d, %d"), args->option,
 		    args->arg2, args->arg3, args->arg4, args->arg5);
 #endif
-   	
-   	switch (args->option) {
-   	case LINUX_PR_SET_PDEATHSIG:
-	   	if (!LINUX_SIG_VALID(args->arg2))
-		   	return (EINVAL);
+
+	switch (args->option) {
+	case LINUX_PR_SET_PDEATHSIG:
+		if (!LINUX_SIG_VALID(args->arg2))
+			return (EINVAL);
 		em = em_find(p, EMUL_UNLOCKED);
 		KASSERT(em != NULL, ("prctl: emuldata not found.\n"));
 		em->pdeath_signal = args->arg2;
 		EMUL_UNLOCK(&emul_lock);
-	   	break;
+		break;
 	case LINUX_PR_GET_PDEATHSIG:
 		em = em_find(p, EMUL_UNLOCKED);
 		KASSERT(em != NULL, ("prctl: emuldata not found.\n"));
 		error = copyout(&em->pdeath_signal,
-			    (void *)(register_t) args->arg2,
-			    sizeof(em->pdeath_signal));
+		    (void *)(register_t)args->arg2,
+		    sizeof(em->pdeath_signal));
 		EMUL_UNLOCK(&emul_lock);
 		break;
 	case LINUX_PR_SET_NAME:
@@ -1652,12 +1650,12 @@
 		 */
 		max_size = (sizeof(comm) <= sizeof(p->p_comm)) ?
 		    sizeof(comm) : sizeof(p->p_comm);
-		error = copyinstr((void *)(register_t) args->arg2, comm,
+		error = copyinstr((void *)(register_t)args->arg2, comm,
 		    max_size, NULL);
 
 		/* Linux silently truncates the name if it is too long. */
 		if (error && error != ENAMETOOLONG)
-		   	return (error);
+			return (error);
 		comm[sizeof(comm) - 1] = '\0';	/* terminate if truncated */
 
 		PROC_LOCK(p);
@@ -1668,8 +1666,8 @@
 		PROC_LOCK(p);
 		strlcpy(comm, p->p_comm, sizeof(comm));
 		PROC_UNLOCK(p);
-		error = copyout(comm, (void *)(register_t) args->arg2,
-		    strlen(comm)+1);
+		error = copyout(comm, (void *)(register_t)args->arg2,
+		    strlen(comm) + 1);
 		break;
 	default:
 		error = EINVAL;
@@ -1682,5 +1680,5 @@
 int
 linux_chroot(struct thread *td, struct linux_chroot_args *args)
 {
-   	return (chroot(td, (struct chroot_args *) args));
+	return (chroot(td, (struct chroot_args *)args));
 }

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

@@ -32,12 +32,14 @@
 #define	_LINUX_MISC_H_
 
 /* defines for prctl */
-#define	LINUX_PR_SET_PDEATHSIG  1  /* Second arg is a signal. */
-#define	LINUX_PR_GET_PDEATHSIG  2  /* Second arg is a ptr to return the signal. */
-#define	LINUX_PR_SET_NAME	15 /* Set process name. */
-#define	LINUX_PR_GET_NAME	16 /* Get process name. */
+#define	LINUX_PR_SET_PDEATHSIG  1	/* Second arg is a signal. */
+#define	LINUX_PR_GET_PDEATHSIG  2	/*
+					 * Second arg is a ptr to return the
+					 * signal.
+					 */
+#define	LINUX_PR_SET_NAME	15	/* Set process name. */
+#define	LINUX_PR_GET_NAME	16	/* Get process name. */
 
-#define	LINUX_MAX_COMM_LEN	16 /* Maximum length of the process name. */
+#define	LINUX_MAX_COMM_LEN	16	/* Maximum length of the process name. */
 
-#endif /* _LINUX_MISC_H_ */
-
+#endif	/* _LINUX_MISC_H_ */



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