History log of /arch/um/os-Linux/helper.c
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
078073a3d48ce7c140f1538d249da3ac545065a6 18-Aug-2011 Al Viro <viro@ftp.linux.org.uk> um: -include user.h for USER_OBJ, trim includes

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Richard Weinberger <richard@nod.at>
/arch/um/os-Linux/helper.c
2fdf2130926f07881c75e3905ece472c37d7703f 26-Jul-2011 Vitaliy Ivanov <vitalivanov@gmail.com> uml: helper.c warning corrections

Fix this warning:

arch/um/os-Linux/helper.c: In function `helper_child':
arch/um/os-Linux/helper.c:38:7: warning: ignoring return value of `write', declared with attribute warn_unused_result

[richard@nod.at: happens only with -D_FORTIFY_SOURCE=2]
Signed-off-by: Vitaliy Ivanov <vitalivanov@gmail.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/arch/um/os-Linux/helper.c
7f3c1fa4c3f52ef65005ae5162e5173e875b8c0c 19-Apr-2010 Jan Kiszka <jan.kiszka@web.de> uml: Fix build breakage after slab.h changes

We now have to to include linux/slab.h explicitly for kmalloc &
friends. Files that build against host headers already get their
prototypes via um_malloc.h, linux/slab.h may even be unavailable.

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Signed-off-by: Tejun Heo <tj@kernel.org>
/arch/um/os-Linux/helper.c
5a0e3ad6af8660be21ca98a971cd00f331318c05 24-Mar-2010 Tejun Heo <tj@kernel.org> include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h

percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.

http://userweb.kernel.org/~tj/misc/slabh-sweep.py

The script does the followings.

* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.

* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.

* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.

The conversion was done in the following steps.

1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.

2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.

3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.

4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.

5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.

6. percpu.h was updated not to include slab.h.

7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).

* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig

8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.

Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.

Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
/arch/um/os-Linux/helper.c
edf382bc6d4429d796fc3b26f7a33eaeca9db8ec 20-Sep-2009 Jaswinder Singh Rajput <jaswinderrajput@gmail.com> includecheck fix: um, helper.c

fix the following 'make includecheck' warning:

arch/um/os-Linux/helper.c: linux/limits.h is included more than once.

Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
Cc: jdike@addtoit.com
Cc: Sam Ravnborg <sam@ravnborg.org>
LKML-Reference: <1247064950.4382.45.camel@ht.satnam>
Acked-by: WANG Cong <xiyou.wangcong@gmail.com>
/arch/um/os-Linux/helper.c
b6d8adf477439e7086224bc9674c6b6638780783 06-Jun-2008 Ingo Molnar <mingo@elte.hu> uml: PATH_MAX needs limits.h

Include limits.h to get a definition of PATH_MAX.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/arch/um/os-Linux/helper.c
43f5b3085fdd27c4edf535d938b2cb0ccead4f75 12-May-2008 Jeff Dike <jdike@addtoit.com> uml: fix build when SLOB is enabled

Reintroduce uml_kmalloc for the benefit of UML libc code. The
previous tactic of declaring __kmalloc so it could be called directly
from the libc side of the house turned out to be getting too intimate
with slab, and it doesn't work with slob.

So, the uml_kmalloc wrapper is back. It calls kmalloc or whatever
that translates into, and libc code calls it.

kfree is left alone since that still works, leaving a somewhat
inconsistent API.

Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Cc: WANG Cong <xiyou.wangcong@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/arch/um/os-Linux/helper.c
297e1b256b1090adbb4357608be3d4301e76c0ce 26-Apr-2008 Ingo Molnar <mingo@elte.hu> uml: fix build error

fix:

arch/um/os-Linux/helper.c: In function 'run_helper':
arch/um/os-Linux/helper.c:73: error: 'PATH_MAX' undeclared (first use in this function)

Signed-off-by: Ingo Molnar <mingo@elte.hu>
/arch/um/os-Linux/helper.c
1aa351a308d2c3ddb92b6cc45083fc54271d0010 05-Feb-2008 Jeff Dike <jdike@addtoit.com> uml: tidy helper code

Style fixes to arch/um/os/helper.c and tidying up the breakpoint fix a
bit.

helper.c gets all the usual style fixes -
updated copyright
all printks get severities

Also -
errval changes to err in helper_child
fixed an obsolete comment
run_helper was killing a child process which is guaranteed to
be dead or dying anyway

Removed the nohang and pname arguments from helper_wait and fixed the
declaration and callers. nohang was used only in the slirp driver and
I don't think it was needed. I think pname was a bit of overkill in
putting out an error message when something goes wrong.

Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/arch/um/os-Linux/helper.c
4dbed85a35ed37d9608f4f32e5d69efa775d6223 18-Dec-2007 Stanislaw Gruszka <stf_xl@wp.pl> uml: stop gdb from deleting breakpoints when running UML

Sometimes when UML is debugged gdb miss breakpoints.

When process traced by gdb do fork, debugger remove breakpoints from
child address space. There is possibility to trace more than one fork,
but this not work with UML, I guess (only guess) there is a deadlock -
gdb waits for UML and UML waits for gdb.

When clone() is called with SIGCHLD and CLONE_VM flags, gdb see this
as PTRACE_EVENT_FORK not as PTRACE_EVENT_CLONE and remove breakpoints
from child and at the same time from traced process, because either
have the same address space.

Maybe it is possible to do fix in gdb, but I'm not sure if there is
easy way to find out if traced and child processes share memory. So I
do fix for UML, it simply do not call clone() with both SIGCHLD and
CLONE_VM flags together. Additionally __WALL flag is used for
waitpid() to assure not miss clone and normal process events.

[ jdike - checkpatch fixes ]

Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/arch/um/os-Linux/helper.c
512b6fb1c14d4c34f23a3419b0789ad01914a899 16-Oct-2007 Jeff Dike <jdike@addtoit.com> uml: userspace files should call libc directly

A number of files that were changed in the recent removal of tt mode
are userspace files which call the os_* wrappers instead of calling
libc directly. A few other files were affected by this, through

This patch makes these call glibc directly.

There are also style fixes in the affected areas.

os_print_error has no remaining callers, so it is deleted.

There is a interface change to os_set_exec_close, eliminating a
parameter which was always the same. The callers are fixed as well.

os_process_pc got its error path cleaned up.

Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/arch/um/os-Linux/helper.c
e4c4bf9968cb4f0fceb1b8fb54790ccae73caf4e 16-Jul-2007 Jeff Dike <jdike@addtoit.com> uml: Eliminate kernel allocator wrappers

UML had two wrapper procedures for kmalloc, um_kmalloc and um_kmalloc_atomic
because the flag constants weren't available in userspace code.
kern_constants.h had made kernel constants available for a long time, so there
is no need for these wrappers any more. Rather, userspace code calls kmalloc
directly with the userspace versions of the gfp flags.

kmalloc isn't a real procedure, so I had to essentially copy the inline
wrapper around __kmalloc.

vmalloc also had its own wrapper for no good reason. This is now gone.

Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/arch/um/os-Linux/helper.c
c43990162fc7f9d2f15a12797fdc6f9c0905f704 16-Jul-2007 Jeff Dike <jdike@addtoit.com> uml: simplify helper stack handling

run_helper and run_helper_thread had arguments which were the same in all
callers. run_helper's stack_out was always NULL and run_helper_thread's
stack_order was always 0. These are now gone, and the constants folded
into the code.

Also fixed leaks of the helper stack in the AIO and SIGIO code.

Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/arch/um/os-Linux/helper.c
a61f334fd2864b9b040f7e882726426ed7e8a317 06-May-2007 Jeff Dike <jdike@addtoit.com> uml: convert libc layer to call read and write

This patch converts calls in the os layer to os_{read,write}_file to calls
directly to libc read() and write() where it is clear that the I/O buffer is
in the kernel.

We can do that here instead of calling os_{read,write}_file_k since we are in
libc code and can call libc directly.

With the change in the calls, error handling needs to be changed to refer to
errno directly rather than the return value of the call.

CATCH_EINTR wrappers were also added where needed.

Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/arch/um/os-Linux/helper.c
ef0470c053274c343b2be8737e0146d65e17f9be 06-May-2007 Jeff Dike <jdike@addtoit.com> uml: tidy libc code

This patch lays some groundwork for the next one, which converts calls to
os_{read,write}_file into {read,write}, by doing some tidying in the affected
areas.

do_not_aio gets restructured to make the final result a bit cleaner.

There are also whitespace and other formatting fixes, fixes in error messages,
and a typo fix.

Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/arch/um/os-Linux/helper.c
1ffb9164f51094b7105ce9f81600b222ddf5b82c 06-May-2007 Jeff Dike <jdike@addtoit.com> uml: remove page_size()

userspace code used to have to call the kernelspace function page_size() in
order to determine the value of the kernel's PAGE_SIZE. Since this is now
available directly from kern_constants.h as UM_KERN_PAGE_SIZE, page_size() can
be deleted and calls changed to use the constant.

Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/arch/um/os-Linux/helper.c
9218b1714949095bff9d9739d80f431d58e561d6 06-May-2007 Jeff Dike <jdike@addtoit.com> uml: remove user_util.h

user_util.h isn't needed any more, so delete it and remove all includes of it.

Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/arch/um/os-Linux/helper.c
11100b1dfb6e9444d54d38e822753f59ee42a7e6 06-May-2007 Jeff Dike <jdike@addtoit.com> uml: delete unused code

Get rid of a bunch of unused stuff -
cpu_feature had no users
linux_prog is little-used, so its declaration is moved to the
user for easy deletion when the whole file goes away
a long-unused debugging aid in helper.c is gone

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/arch/um/os-Linux/helper.c
5d48545e5e88ab7a27ba6a5cb1e8fff617754b61 25-Nov-2006 Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> [PATCH] uml: make execvp safe for our usage

Reimplement execvp for our purposes - after we call fork() it is fundamentally
unsafe to use the kernel allocator - current is not valid there. So we simply
pass to our modified execvp() a preallocated buffer. This fixes a real bug
and works very well in testing (I've seen indirectly warning messages from the
forked thread - they went on the pipe connected to its stdout and where read
as a number by UML, when calling read_output(). I verified the obtained
number corresponded to "BUG:").

The added use of __cant_sleep() is not a new bug since __cant_sleep() is
already used in the same function - passing an atomicity parameter would be
better but it would require huge change, stating that this function must not
be called in atomic context and can sleep is a better idea (will make sure of
this gradually).

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Acked-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
/arch/um/os-Linux/helper.c
d9d645f06a8f50659bbae2be64ed8367ba068fc0 20-Oct-2006 Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> [PATCH] uml: cleanup run_helper() API to fix a leak

Freeing the stack is left uselessly to the caller of run_helper in some cases
- this is taken from run_helper_thread, but here it is useless, so no caller
needs it and the only place where this happens has a potential leak - in case
of error neither run_helper() nor xterm_open() call free_stack(). At this
point passing a pointer is not needed - the stack pointer should be passed
directly, but this change is not done here.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
/arch/um/os-Linux/helper.c
8b028bcd0e746ae0f2f218b911032232a32dedd5 20-Oct-2006 Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> [PATCH] uml: code convention cleanup of a file

Fix coding conventions violations is arch/um/os-Linux/helper.c.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
/arch/um/os-Linux/helper.c
6b7aaad9ba4f2a059a70014be12a921eceebfc47 26-Sep-2006 Jeff Dike <jdike@addtoit.com> [PATCH] uml: Fix handling of failed execs of helpers

There were some bugs in handling failures to exec helper programs. errno was
passed back from the child with the wrong sign. It was also ignored. In the
case where it mattered, the errno from the (successful) read in the parent was
used instead.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
/arch/um/os-Linux/helper.c
b1c332c9e813cbee6ca77c3a66ee4d312eb96770 11-Apr-2006 Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> [PATCH] uml: fix hang on run_helper() failure on uml_net

Fix an hang on a pipe when run_helper() fails when called by change_tramp()
(i.e. when calling uml_net) - reproduced the bug and verified this fixes it.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
/arch/um/os-Linux/helper.c
b63162939cd797c8269964ce856ed1f2fec5f70e 19-Jan-2006 Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> [PATCH] uml: avoid malloc to sleep in atomic sections

Ugly trick to help make malloc not sleeping - we can't do anything else. But
this is not yet optimal, since spinlock don't trigger in_atomic() when
preemption is disabled.

Also, even if ugly, this was already used in one place, and was even more
bogus. Fix it.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
/arch/um/os-Linux/helper.c
ff5c6ff54215fe284e515032878111de5d8a5ce1 07-Nov-2005 Jeff Dike <jdike@addtoit.com> [PATCH] uml: separate libc-dependent helper code

The serial UML OS-abstraction layer patch (um/kernel dir).

This moves all systemcalls from helper.c file under os-Linux dir

Signed-off-by: Gennady Sharapov <Gennady.V.Sharapov@intel.com>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
/arch/um/os-Linux/helper.c