type
stringclasses
5 values
content
stringlengths
9
163k
includes
#include <linux/oom.h>
includes
#include <linux/writeback.h>
includes
#include <linux/shm.h>
includes
#include <asm/uaccess.h>
includes
#include <asm/unistd.h>
includes
#include <asm/pgtable.h>
includes
#include <asm/mmu_context.h>
includes
#include <litmus/litmus.h>
structs
struct wait_opts { enum pid_type wo_type; int wo_flags; struct pid *wo_pid; struct siginfo __user *wo_info; int __user *wo_stat; struct rusage __user *wo_rusage; wait_queue_t child_wait; int notask_error; };
functions
void __unhash_process(struct task_struct *p, bool group_dead) { nr_threads--; detach_pid(p, PIDTYPE_PID); if (group_dead) { detach_pid(p, PIDTYPE_PGID); detach_pid(p, PIDTYPE_SID); list_del_rcu(&p->tasks); list_del_init(&p->sibling); __this_cpu_dec(process_counts); }
functions
void __exit_signal(struct task_struct *tsk) { struct signal_struct *sig = tsk->signal; bool group_dead = thread_group_leader(tsk); struct sighand_struct *sighand; struct tty_struct *uninitialized_var(tty); cputime_t utime, stime; sighand = rcu_dereference_check(tsk->sighand, lockdep_tasklist_lock_is_held())...
functions
void delayed_put_task_struct(struct rcu_head *rhp) { struct task_struct *tsk = container_of(rhp, struct task_struct, rcu); perf_event_delayed_put(tsk); trace_sched_process_free(tsk); put_task_struct(tsk); }
functions
void release_task(struct task_struct * p) { struct task_struct *leader; int zap_leader; repeat: /* don't need to get the RCU readlock here - the process is dead and * can't be modifying its own credentials. But shut RCU-lockdep up */ rcu_read_lock(); atomic_dec(&__task_cred(p)->user->processes); rcu_read_unlock...
functions
int will_become_orphaned_pgrp(struct pid *pgrp, struct task_struct *ignored_task) { struct task_struct *p; do_each_pid_task(pgrp, PIDTYPE_PGID, p) { if ((p == ignored_task) || (p->exit_state && thread_group_empty(p)) || is_global_init(p->real_parent)) continue; if (task_pgrp(p->real_parent) != pg...
functions
int is_current_pgrp_orphaned(void) { int retval; read_lock(&tasklist_lock); retval = will_become_orphaned_pgrp(task_pgrp(current), NULL); read_unlock(&tasklist_lock); return retval; }
functions
bool has_stopped_jobs(struct pid *pgrp) { struct task_struct *p; do_each_pid_task(pgrp, PIDTYPE_PGID, p) { if (p->signal->flags & SIGNAL_STOP_STOPPED) return true; }
functions
void kill_orphaned_pgrp(struct task_struct *tsk, struct task_struct *parent) { struct pid *pgrp = task_pgrp(tsk); struct task_struct *ignored_task = tsk; if (!parent) /* exit: our father is in a different pgrp than * we are and we were the only connection outside. */ parent = tsk->real_parent; else ...
functions
void __set_special_pids(struct pid *pid) { struct task_struct *curr = current->group_leader; if (task_session(curr) != pid) change_pid(curr, PIDTYPE_SID, pid); if (task_pgrp(curr) != pid) change_pid(curr, PIDTYPE_PGID, pid); }
functions
int allow_signal(int sig) { if (!valid_signal(sig) || sig < 1) return -EINVAL; spin_lock_irq(&current->sighand->siglock); /* This is only needed for daemonize()'ed kthreads */ sigdelset(&current->blocked, sig); /* * Kernel threads handle their own signals. Let the signal code * know it'll be handled, so tha...
functions
int disallow_signal(int sig) { if (!valid_signal(sig) || sig < 1) return -EINVAL; spin_lock_irq(&current->sighand->siglock); current->sighand->action[(sig)-1].sa.sa_handler = SIG_IGN; recalc_sigpending(); spin_unlock_irq(&current->sighand->siglock); return 0; }
functions
void mm_update_next_owner(struct mm_struct *mm) { struct task_struct *c, *g, *p = current; retry: /* * If the exiting or execing task is not the owner, it's * someone else's problem. */ if (mm->owner != p) return; /* * The current owner is exiting/execing and there are no other * candidates. Do not le...
functions
void exit_mm(struct task_struct * tsk) { struct mm_struct *mm = tsk->mm; struct core_state *core_state; mm_release(tsk, mm); if (!mm) return; sync_mm_rss(mm); /* * Serialize with any possible pending coredump. * We must hold mmap_sem around checking core_state * and clearing tsk->mm. The core-inducing t...
functions
else if (father->signal->has_child_subreaper) { struct task_struct *reaper; /* * Find the first ancestor marked as child_subreaper. * Note that the code below checks same_thread_group(reaper, * pid_ns->child_reaper). This is what we need to DTRT in a * PID namespace. However we still need the check ab...
functions
void reparent_leader(struct task_struct *father, struct task_struct *p, struct list_head *dead) { list_move_tail(&p->sibling, &p->real_parent->children); /* * If this is a threaded reparent there is no need to * notify anyone anything has happened. */ if (same_thread_group(p->real_parent, father)) return...
functions
void forget_original_parent(struct task_struct *father) { struct task_struct *p, *n, *reaper; LIST_HEAD(dead_children); write_lock_irq(&tasklist_lock); /* * Note that exit_ptrace() and find_new_reaper() might * drop tasklist_lock and reacquire it. */ exit_ptrace(father); reaper = find_new_reaper(father); ...
functions
void exit_notify(struct task_struct *tsk, int group_dead) { bool autoreap; /* * This does two things: * * A. Make init inherit all the child processes * B. Check to see if any process groups have become orphaned * as a result of our exiting, and if they have any stopped * jobs, send them a SIGHUP and...
functions
void check_stack_usage(void) { static DEFINE_SPINLOCK(low_water_lock); static int lowest_to_date = THREAD_SIZE; unsigned long free; free = stack_not_used(current); if (free >= lowest_to_date) return; spin_lock(&low_water_lock); if (free < lowest_to_date) { printk(KERN_WARNING "%s (%d) used greatest stack ...
functions
void check_stack_usage(void) {}
functions
void do_exit(long code) { struct task_struct *tsk = current; int group_dead; profile_task_exit(tsk); WARN_ON(blk_needs_flush_plug(tsk)); if (unlikely(in_interrupt())) panic("Aiee, killing interrupt handler!"); if (unlikely(!tsk->pid)) panic("Attempted to kill the idle task!"); if (unlikely(is_realtime(ts...
functions
void complete_and_exit(struct completion *comp, long code) { if (comp) complete(comp); do_exit(code); }
functions
void do_group_exit(int exit_code) { struct signal_struct *sig = current->signal; BUG_ON(exit_code & 0x80); /* core dumps don't get here */ if (signal_group_exit(sig)) exit_code = sig->group_exit_code; else if (!thread_group_empty(current)) { struct sighand_struct *const sighand = current->sighand; spin_lock...
functions
int eligible_pid(struct wait_opts *wo, struct task_struct *p) { return wo->wo_type == PIDTYPE_MAX || task_pid_type(p, wo->wo_type) == wo->wo_pid; }
functions
int eligible_child(struct wait_opts *wo, struct task_struct *p) { if (!eligible_pid(wo, p)) return 0; /* Wait for all children (clone and not) if __WALL is set; * otherwise, wait for clone children *only* if __WCLONE is * set; otherwise, wait for non-clone children *only*. (Note: * A "clone" child here is on...
functions
int wait_noreap_copyout(struct wait_opts *wo, struct task_struct *p, pid_t pid, uid_t uid, int why, int status) { struct siginfo __user *infop; int retval = wo->wo_rusage ? getrusage(p, RUSAGE_BOTH, wo->wo_rusage) : 0; put_task_struct(p); infop = wo->wo_info; if (infop) { if (!retval) retval = put_user...
functions
int wait_task_zombie(struct wait_opts *wo, struct task_struct *p) { unsigned long state; int retval, status, traced; pid_t pid = task_pid_vnr(p); uid_t uid = from_kuid_munged(current_user_ns(), task_uid(p)); struct siginfo __user *infop; if (!likely(wo->wo_flags & WEXITED)) return 0; if (unlikely(wo->wo_flag...
functions
int wait_task_stopped(struct wait_opts *wo, int ptrace, struct task_struct *p) { struct siginfo __user *infop; int retval, exit_code, *p_code, why; uid_t uid = 0; /* unneeded, required by compiler */ pid_t pid; /* * Traditionally we see ptrace'd stopped tasks regardless of options. */ if (!ptrace && !(wo...
functions
int wait_task_continued(struct wait_opts *wo, struct task_struct *p) { int retval; pid_t pid; uid_t uid; if (!unlikely(wo->wo_flags & WCONTINUED)) return 0; if (!(p->signal->flags & SIGNAL_STOP_CONTINUED)) return 0; spin_lock_irq(&p->sighand->siglock); /* Re-check with the lock held. */ if (!(p->signal-...
functions
int wait_consider_task(struct wait_opts *wo, int ptrace, struct task_struct *p) { int ret = eligible_child(wo, p); if (!ret) return ret; ret = security_task_wait(p); if (unlikely(ret < 0)) { /* * If we have not yet seen any eligible child, * then let this error code replace -ECHILD. * A permission...
functions
int do_wait_thread(struct wait_opts *wo, struct task_struct *tsk) { struct task_struct *p; list_for_each_entry(p, &tsk->children, sibling) { int ret = wait_consider_task(wo, 0, p); if (ret) return ret; }
functions
int ptrace_do_wait(struct wait_opts *wo, struct task_struct *tsk) { struct task_struct *p; list_for_each_entry(p, &tsk->ptraced, ptrace_entry) { int ret = wait_consider_task(wo, 1, p); if (ret) return ret; }
functions
int child_wait_callback(wait_queue_t *wait, unsigned mode, int sync, void *key) { struct wait_opts *wo = container_of(wait, struct wait_opts, child_wait); struct task_struct *p = key; if (!eligible_pid(wo, p)) return 0; if ((wo->wo_flags & __WNOTHREAD) && wait->private != p->parent) return 0; retu...
functions
void __wake_up_parent(struct task_struct *p, struct task_struct *parent) { __wake_up_sync_key(&parent->signal->wait_chldexit, TASK_INTERRUPTIBLE, 1, p); }
functions
long do_wait(struct wait_opts *wo) { struct task_struct *tsk; int retval; trace_sched_process_wait(wo->wo_pid); init_waitqueue_func_entry(&wo->child_wait, child_wait_callback); wo->child_wait.private = current; add_wait_queue(&current->signal->wait_chldexit, &wo->child_wait); repeat: /* * If there is nothing...
functions
else if (infop) { /* * For a WNOHANG return, clear out all the fields * we would set so the user can easily tell the * difference. */ if (!ret) ret = put_user(0, &infop->si_signo); if (!ret) ret = put_user(0, &infop->si_errno); if (!ret) ret = put_user(0, &infop->si_code); if (!ret) re...
functions
else if (upid < 0) { type = PIDTYPE_PGID; pid = find_get_pid(-upid); }
functions
else if (upid == 0) { type = PIDTYPE_PGID; pid = get_task_pid(current, PIDTYPE_PGID); }
includes
#include <cyg/io/spi.h>
includes
#include <cyg/io/flash.h>
includes
#include <cyg/io/flash_dev.h>
includes
#include <cyg/infra/cyg_type.h>
includes
#include <cyg/infra/cyg_ass.h>
includes
#include <pkgconf/devs_flash_spi_m25pxx.h>
includes
#include <string.h>
defines
#define M25PXX_POLLED false
defines
#define M25PXX_POLLED true
defines
#define M25PXX_DELAY_MS(_msdelay_) cyg_thread_delay (\
defines
#define M25PXX_DELAY_MS(_msdelay_) CYGACC_CALL_IF_DELAY_US (_msdelay_ * 1000)
defines
#define TODO_M25P(_msg_) CYG_ASSERT(false, "TODO (M25P) : " _msg_)
defines
#define FAIL_M25P(_msg_) CYG_ASSERT(false, "FAIL (M25P) : " _msg_)
defines
#define ASSERT_M25P(_test_, _msg_) CYG_ASSERT(_test_, "FAIL (M25P) : " _msg_)
defines
#define TRACE_M25P(_msg_, _args_...) if (dev->pf) dev->pf ("M25PXX : " _msg_, ##_args_)
defines
#define M25PXX_STATUS_WIP 0x01 /* Write in progress. */
defines
#define M25PXX_STATUS_WEL 0x02 /* Write enable latch. */
defines
#define M25PXX_STATUS_BP0 0x04 /* Block protect 0. */
defines
#define M25PXX_STATUS_BP1 0x08 /* Block protect 1. */
defines
#define M25PXX_STATUS_BP2 0x10 /* Block protect 2. */
defines
#define M25PXX_STATUS_SRWD 0x80 /* Status register write protect. */
defines
#define M25PXX_PAGE_SIZE 256
functions
cyg_bool m25pxx_to_local_addr (struct cyg_flash_dev* dev, cyg_flashaddr_t* addr) { cyg_bool retval = false; // Range check address before modifying it. if ((*addr >= dev->start) && (*addr <= dev->end)) { *addr -= dev->start; retval = true; }
functions
cyg_uint32 m25pxx_spi_rdid (struct cyg_flash_dev *dev) { cyg_spi_device* spi_device = (cyg_spi_device*) dev->priv; const cyg_uint8 tx_buf [4] = { M25PXX_CMD_RDID, 0, 0, 0 }
functions
void m25pxx_spi_wren (struct cyg_flash_dev *dev) { cyg_spi_device* spi_device = (cyg_spi_device*) dev->priv; const cyg_uint8 tx_buf [1] = { M25PXX_CMD_WREN }
functions
void m25pxx_spi_se (struct cyg_flash_dev *dev, cyg_flashaddr_t addr) { cyg_spi_device* spi_device = (cyg_spi_device*) dev->priv; const cyg_uint8 tx_buf [4] = { M25PXX_CMD_SE, (cyg_uint8) (addr >> 16), (cyg_uint8) (addr >> 8), (cyg_uint8) (addr) }
functions
cyg_uint8 m25pxx_spi_rdsr (struct cyg_flash_dev *dev) { cyg_spi_device* spi_device = (cyg_spi_device*) dev->priv; const cyg_uint8 tx_buf [2] = { M25PXX_CMD_RDSR, 0 }
functions
void m25pxx_spi_pp (struct cyg_flash_dev *dev, cyg_flashaddr_t addr, cyg_uint8* wbuf, cyg_uint32 wbuf_len) { cyg_spi_device* spi_device = (cyg_spi_device*) dev->priv; const cyg_uint8 tx_buf [4] = { M25PXX_CMD_PP, (cyg_uint8) (addr >> 16), (cyg_uint8) (addr >> 8), (cyg_uint8) (addr) }
functions
void m25pxx_spi_fread (struct cyg_flash_dev *dev, cyg_flashaddr_t addr, cyg_uint8* rbuf, cyg_uint32 rbuf_len) { cyg_spi_device* spi_device = (cyg_spi_device*) dev->priv; const cyg_uint8 tx_buf [5] = { M25PXX_CMD_FREAD, (cyg_uint8) (addr >> 16), (cyg_uint8) (addr >> 8), (cyg_uint8) (addr), 0 }
functions
int m25pxx_init (struct cyg_flash_dev *dev) { m25pxx_params* dev_params = (m25pxx_params*) m25pxx_supported_devices; cyg_uint32 device_id; int retval = FLASH_ERR_INVALID; // Find the device in the supported devices list. device_id = m25pxx_spi_rdid (dev); while ((dev_params->jedec_id != 0) && (dev_params...
functions
int m25pxx_erase_block (struct cyg_flash_dev *dev, cyg_flashaddr_t block_base) { cyg_flashaddr_t local_base = block_base; int retval = FLASH_ERR_INVALID; cyg_uint8 dev_status; // Fix up the block address and send the sector erase command. if (m25pxx_to_local_addr (dev, &local_base)) { m25pxx_spi_wren (...
functions
int m25pxx_program (struct cyg_flash_dev *dev, cyg_flashaddr_t base, const void* data, size_t len) { cyg_flashaddr_t local_base = base; int retval = FLASH_ERR_OK; cyg_uint8* tx_ptr = (cyg_uint8*) data; cyg_uint32 tx_bytes_left = (cyg_uint32) len; cyg_uint32 tx_bytes; cyg_uint8 dev_status; // Fix up th...
functions
int m25pxx_read (struct cyg_flash_dev *dev, const cyg_flashaddr_t base, void* data, size_t len) { cyg_flashaddr_t local_base = base; int retval = FLASH_ERR_INVALID; cyg_uint8* rx_ptr = (cyg_uint8*) data; cyg_uint32 rx_bytes_left = (cyg_uint32) len; cyg_uint32 rx_bytes; // Determine the maximum transfer s...
includes
#include <linux/interrupt.h>
includes
#include <linux/oom.h>
includes
#include <linux/suspend.h>
includes
#include <linux/module.h>
includes
#include <linux/syscalls.h>
includes
#include <linux/freezer.h>
includes
#include <linux/delay.h>
includes
#include <linux/workqueue.h>
includes
#include <linux/kmod.h>
includes
#include <linux/wakelock.h>
defines
#define TIMEOUT (20 * HZ)
functions
int try_to_freeze_tasks(bool user_only) { struct task_struct *g, *p; unsigned long end_time; unsigned int todo; bool wq_busy = false; struct timeval start, end; u64 elapsed_csecs64; unsigned int elapsed_csecs; bool wakeup = false; do_gettimeofday(&start); end_time = jiffies + TIMEOUT; if (!user_only) fr...
functions
int freeze_processes(void) { int error; error = suspend_sys_sync_wait(); if (error) return error; error = __usermodehelper_disable(UMH_FREEZING); if (error) return error; if (!pm_freezing) atomic_inc(&system_freezing_cnt); printk("Freezing user space processes ... "); pm_freezing = true; error = try_...
functions
int freeze_kernel_threads(void) { int error; // error = suspend_sys_sync_wait(); // if (error) // return error; printk("Freezing remaining freezable tasks ... "); pm_nosig_freezing = true; error = try_to_freeze_tasks(false); if (!error) printk("done."); printk("\n"); BUG_ON(in_atomic()); if (error) tha...
functions
void thaw_processes(void) { struct task_struct *g, *p; if (pm_freezing) atomic_dec(&system_freezing_cnt); pm_freezing = false; pm_nosig_freezing = false; oom_killer_enable(); printk("Restarting tasks ... "); __usermodehelper_set_disable_depth(UMH_FREEZING); thaw_workqueues(); read_lock(&tasklist_lock); ...
functions
void thaw_kernel_threads(void) { struct task_struct *g, *p; pm_nosig_freezing = false; printk("Restarting kernel threads ... "); thaw_workqueues(); read_lock(&tasklist_lock); do_each_thread(g, p) { if (p->flags & (PF_KTHREAD | PF_WQ_WORKER)) __thaw_task(p); }
includes
#include <linux/kernel.h>
includes
#include <linux/init.h>
includes
#include <linux/module.h>
includes
#include <linux/kthread.h>
includes
#include <linux/mutex.h>