Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
c4144670
Commit
c4144670
authored
Oct 02, 2012
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kill daemonize()
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
02232f8d
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
1 addition
and
128 deletions
+1
-128
drivers/staging/gdm72xx/gdm_usb.c
drivers/staging/gdm72xx/gdm_usb.c
+1
-3
fs/file.c
fs/file.c
+0
-6
fs/fs_struct.c
fs/fs_struct.c
+0
-24
include/linux/fdtable.h
include/linux/fdtable.h
+0
-1
include/linux/fs_struct.h
include/linux/fs_struct.h
+0
-1
include/linux/sched.h
include/linux/sched.h
+0
-1
kernel/exit.c
kernel/exit.c
+0
-92
No files found.
drivers/staging/gdm72xx/gdm_usb.c
View file @
c4144670
...
@@ -701,8 +701,6 @@ static int k_mode_thread(void *arg)
...
@@ -701,8 +701,6 @@ static int k_mode_thread(void *arg)
unsigned
long
flags
,
flags2
,
expire
;
unsigned
long
flags
,
flags2
,
expire
;
int
ret
;
int
ret
;
daemonize
(
"k_mode_wimax"
);
while
(
!
k_mode_stop
)
{
while
(
!
k_mode_stop
)
{
spin_lock_irqsave
(
&
k_lock
,
flags2
);
spin_lock_irqsave
(
&
k_lock
,
flags2
);
...
@@ -764,7 +762,7 @@ static struct usb_driver gdm_usb_driver = {
...
@@ -764,7 +762,7 @@ static struct usb_driver gdm_usb_driver = {
static
int
__init
usb_gdm_wimax_init
(
void
)
static
int
__init
usb_gdm_wimax_init
(
void
)
{
{
#ifdef CONFIG_WIMAX_GDM72XX_K_MODE
#ifdef CONFIG_WIMAX_GDM72XX_K_MODE
kthread_run
(
k_mode_thread
,
NULL
,
"
WiMax_thread
"
);
kthread_run
(
k_mode_thread
,
NULL
,
"
k_mode_wimax
"
);
#endif
/* CONFIG_WIMAX_GDM72XX_K_MODE */
#endif
/* CONFIG_WIMAX_GDM72XX_K_MODE */
return
usb_register
(
&
gdm_usb_driver
);
return
usb_register
(
&
gdm_usb_driver
);
}
}
...
...
fs/file.c
View file @
c4144670
...
@@ -519,12 +519,6 @@ struct files_struct init_files = {
...
@@ -519,12 +519,6 @@ struct files_struct init_files = {
.
file_lock
=
__SPIN_LOCK_UNLOCKED
(
init_task
.
file_lock
),
.
file_lock
=
__SPIN_LOCK_UNLOCKED
(
init_task
.
file_lock
),
};
};
void
daemonize_descriptors
(
void
)
{
atomic_inc
(
&
init_files
.
count
);
reset_files_struct
(
&
init_files
);
}
/*
/*
* allocate a file descriptor, mark it busy.
* allocate a file descriptor, mark it busy.
*/
*/
...
...
fs/fs_struct.c
View file @
c4144670
...
@@ -164,27 +164,3 @@ struct fs_struct init_fs = {
...
@@ -164,27 +164,3 @@ struct fs_struct init_fs = {
.
seq
=
SEQCNT_ZERO
,
.
seq
=
SEQCNT_ZERO
,
.
umask
=
0022
,
.
umask
=
0022
,
};
};
void
daemonize_fs_struct
(
void
)
{
struct
fs_struct
*
fs
=
current
->
fs
;
if
(
fs
)
{
int
kill
;
task_lock
(
current
);
spin_lock
(
&
init_fs
.
lock
);
init_fs
.
users
++
;
spin_unlock
(
&
init_fs
.
lock
);
spin_lock
(
&
fs
->
lock
);
current
->
fs
=
&
init_fs
;
kill
=
!--
fs
->
users
;
spin_unlock
(
&
fs
->
lock
);
task_unlock
(
current
);
if
(
kill
)
free_fs_struct
(
fs
);
}
}
include/linux/fdtable.h
View file @
c4144670
...
@@ -95,7 +95,6 @@ struct task_struct;
...
@@ -95,7 +95,6 @@ struct task_struct;
struct
files_struct
*
get_files_struct
(
struct
task_struct
*
);
struct
files_struct
*
get_files_struct
(
struct
task_struct
*
);
void
put_files_struct
(
struct
files_struct
*
fs
);
void
put_files_struct
(
struct
files_struct
*
fs
);
void
reset_files_struct
(
struct
files_struct
*
);
void
reset_files_struct
(
struct
files_struct
*
);
void
daemonize_descriptors
(
void
);
int
unshare_files
(
struct
files_struct
**
);
int
unshare_files
(
struct
files_struct
**
);
struct
files_struct
*
dup_fd
(
struct
files_struct
*
,
int
*
);
struct
files_struct
*
dup_fd
(
struct
files_struct
*
,
int
*
);
void
do_close_on_exec
(
struct
files_struct
*
);
void
do_close_on_exec
(
struct
files_struct
*
);
...
...
include/linux/fs_struct.h
View file @
c4144670
...
@@ -21,7 +21,6 @@ extern void set_fs_root(struct fs_struct *, struct path *);
...
@@ -21,7 +21,6 @@ extern void set_fs_root(struct fs_struct *, struct path *);
extern
void
set_fs_pwd
(
struct
fs_struct
*
,
struct
path
*
);
extern
void
set_fs_pwd
(
struct
fs_struct
*
,
struct
path
*
);
extern
struct
fs_struct
*
copy_fs_struct
(
struct
fs_struct
*
);
extern
struct
fs_struct
*
copy_fs_struct
(
struct
fs_struct
*
);
extern
void
free_fs_struct
(
struct
fs_struct
*
);
extern
void
free_fs_struct
(
struct
fs_struct
*
);
extern
void
daemonize_fs_struct
(
void
);
extern
int
unshare_fs_struct
(
void
);
extern
int
unshare_fs_struct
(
void
);
static
inline
void
get_fs_root
(
struct
fs_struct
*
fs
,
struct
path
*
root
)
static
inline
void
get_fs_root
(
struct
fs_struct
*
fs
,
struct
path
*
root
)
...
...
include/linux/sched.h
View file @
c4144670
...
@@ -2283,7 +2283,6 @@ extern void flush_itimer_signals(void);
...
@@ -2283,7 +2283,6 @@ extern void flush_itimer_signals(void);
extern
void
do_group_exit
(
int
);
extern
void
do_group_exit
(
int
);
extern
void
daemonize
(
const
char
*
,
...);
extern
int
allow_signal
(
int
);
extern
int
allow_signal
(
int
);
extern
int
disallow_signal
(
int
);
extern
int
disallow_signal
(
int
);
...
...
kernel/exit.c
View file @
c4144670
...
@@ -322,43 +322,6 @@ kill_orphaned_pgrp(struct task_struct *tsk, struct task_struct *parent)
...
@@ -322,43 +322,6 @@ kill_orphaned_pgrp(struct task_struct *tsk, struct task_struct *parent)
}
}
}
}
/**
* reparent_to_kthreadd - Reparent the calling kernel thread to kthreadd
*
* If a kernel thread is launched as a result of a system call, or if
* it ever exits, it should generally reparent itself to kthreadd so it
* isn't in the way of other processes and is correctly cleaned up on exit.
*
* The various task state such as scheduling policy and priority may have
* been inherited from a user process, so we reset them to sane values here.
*
* NOTE that reparent_to_kthreadd() gives the caller full capabilities.
*/
static
void
reparent_to_kthreadd
(
void
)
{
write_lock_irq
(
&
tasklist_lock
);
ptrace_unlink
(
current
);
/* Reparent to init */
current
->
real_parent
=
current
->
parent
=
kthreadd_task
;
list_move_tail
(
&
current
->
sibling
,
&
current
->
real_parent
->
children
);
/* Set the exit signal to SIGCHLD so we signal init on exit */
current
->
exit_signal
=
SIGCHLD
;
if
(
task_nice
(
current
)
<
0
)
set_user_nice
(
current
,
0
);
/* cpus_allowed? */
/* rt_priority? */
/* signals? */
memcpy
(
current
->
signal
->
rlim
,
init_task
.
signal
->
rlim
,
sizeof
(
current
->
signal
->
rlim
));
atomic_inc
(
&
init_cred
.
usage
);
commit_creds
(
&
init_cred
);
write_unlock_irq
(
&
tasklist_lock
);
}
void
__set_special_pids
(
struct
pid
*
pid
)
void
__set_special_pids
(
struct
pid
*
pid
)
{
{
struct
task_struct
*
curr
=
current
->
group_leader
;
struct
task_struct
*
curr
=
current
->
group_leader
;
...
@@ -370,13 +333,6 @@ void __set_special_pids(struct pid *pid)
...
@@ -370,13 +333,6 @@ void __set_special_pids(struct pid *pid)
change_pid
(
curr
,
PIDTYPE_PGID
,
pid
);
change_pid
(
curr
,
PIDTYPE_PGID
,
pid
);
}
}
static
void
set_special_pids
(
struct
pid
*
pid
)
{
write_lock_irq
(
&
tasklist_lock
);
__set_special_pids
(
pid
);
write_unlock_irq
(
&
tasklist_lock
);
}
/*
/*
* Let kernel threads use this to say that they allow a certain signal.
* Let kernel threads use this to say that they allow a certain signal.
* Must not be used if kthread was cloned with CLONE_SIGHAND.
* Must not be used if kthread was cloned with CLONE_SIGHAND.
...
@@ -416,54 +372,6 @@ int disallow_signal(int sig)
...
@@ -416,54 +372,6 @@ int disallow_signal(int sig)
EXPORT_SYMBOL
(
disallow_signal
);
EXPORT_SYMBOL
(
disallow_signal
);
/*
* Put all the gunge required to become a kernel thread without
* attached user resources in one place where it belongs.
*/
void
daemonize
(
const
char
*
name
,
...)
{
va_list
args
;
sigset_t
blocked
;
va_start
(
args
,
name
);
vsnprintf
(
current
->
comm
,
sizeof
(
current
->
comm
),
name
,
args
);
va_end
(
args
);
/*
* If we were started as result of loading a module, close all of the
* user space pages. We don't need them, and if we didn't close them
* they would be locked into memory.
*/
exit_mm
(
current
);
/*
* We don't want to get frozen, in case system-wide hibernation
* or suspend transition begins right now.
*/
current
->
flags
|=
(
PF_NOFREEZE
|
PF_KTHREAD
);
if
(
current
->
nsproxy
!=
&
init_nsproxy
)
{
get_nsproxy
(
&
init_nsproxy
);
switch_task_namespaces
(
current
,
&
init_nsproxy
);
}
set_special_pids
(
&
init_struct_pid
);
proc_clear_tty
(
current
);
/* Block and flush all signals */
sigfillset
(
&
blocked
);
sigprocmask
(
SIG_BLOCK
,
&
blocked
,
NULL
);
flush_signals
(
current
);
/* Become as one with the init task */
daemonize_fs_struct
();
daemonize_descriptors
();
reparent_to_kthreadd
();
}
EXPORT_SYMBOL
(
daemonize
);
#ifdef CONFIG_MM_OWNER
#ifdef CONFIG_MM_OWNER
/*
/*
* A task is exiting. If it owned this mm, find a new owner for the mm.
* A task is exiting. If it owned this mm, find a new owner for the mm.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment