Re: [PATCH 2/7] rename the provided execve functions tokernel_execve

From: Randy.Dunlap
Date: Sun Aug 27 2006 - 22:14:27 EST


On Sun, 27 Aug 2006 23:47:36 +0200 Arnd Bergmann wrote:

> --- linux-cg.orig/drivers/sbus/char/envctrl.c 2006-08-27 23:36:36.000000000 +0200
> +++ linux-cg/drivers/sbus/char/envctrl.c 2006-08-27 23:36:42.000000000 +0200
> @@ -19,9 +19,6 @@
> * Daniele Bellucci <bellucda@xxxxxxxxxx>
> */
>
> -#define __KERNEL_SYSCALLS__
> -static int errno;
> -
> #include <linux/module.h>
> #include <linux/sched.h>
> #include <linux/kthread.h>
> @@ -982,7 +979,7 @@
>
> inprog = 1;
> printk(KERN_CRIT "kenvctrld: WARNING: Shutting down the system now.\n");
> - if (0 > execve("/sbin/shutdown", argv, envp)) {
> + if (0 > kernel_execve("/sbin/shutdown", argv, envp)) {
> printk(KERN_CRIT "kenvctrld: WARNING: system shutdown failed!\n");
> inprog = 0; /* unlikely to succeed, but we could try again */
> }

Linux just educated the git mailing list (yesterday) about ordering
of comparisons, so while here, please change the order inside the if()
to be like the others:
if (kernel_execv(...) < 0)


> Index: linux-cg/include/linux/syscalls.h
> ===================================================================
> --- linux-cg.orig/include/linux/syscalls.h 2006-08-27 23:36:36.000000000 +0200
> +++ linux-cg/include/linux/syscalls.h 2006-08-27 23:36:42.000000000 +0200
> @@ -597,4 +597,6 @@
> asmlinkage long sys_set_robust_list(struct robust_list_head __user *head,
> size_t len);
>
> +int kernel_execve(const char *filename, char *const argv[], char *const envp[]);
> +
> #endif

Question:
All other syscalls (in syscalls.h) return long or unsigned long
or ssize_t etc. I.e., none of them return int. Does this one
return int because it's strictly an inside-the-kernel "syscall",
not exposed to userspace?


---
~Randy
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/