type
stringclasses
5 values
content
stringlengths
9
163k
includes
#include <linux/notifier.h>
includes
#include <linux/mm.h>
includes
#include <linux/cpumask.h>
includes
#include <linux/cpu.h>
includes
#include <linux/profile.h>
includes
#include <linux/highmem.h>
includes
#include <asm/sections.h>
includes
#include <asm/semaphore.h>
includes
#include <linux/proc_fs.h>
includes
#include <asm/uaccess.h>
includes
#include <asm/ptrace.h>
defines
#define PROFILE_GRPSHIFT 3
defines
#define PROFILE_GRPSZ (1 << PROFILE_GRPSHIFT)
defines
#define NR_PROFILE_HIT (PAGE_SIZE/sizeof(struct profile_hit))
defines
#define NR_PROFILE_GRP (NR_PROFILE_HIT/PROFILE_GRPSZ)
defines
#define profile_flip_buffers() do { } while (0)
defines
#define profile_discard_flip_buffers() do { } while (0)
defines
#define create_hash_tables() ({ 0; })
structs
struct profile_hit { u32 pc, hits; };
functions
__init profile_setup(char * str) { int par; if (!strncmp(str, "schedule", 8)) { prof_on = SCHED_PROFILING; printk(KERN_INFO "kernel schedule profiling enabled\n"); if (str[7] == ',') str += 8; }
functions
__init profile_init(void) { if (!prof_on) return; /* only text is profiled */ prof_len = (_etext - _stext) >> prof_shift; prof_buffer = alloc_bootmem(prof_len*sizeof(atomic_t)); }
functions
void profile_task_exit(struct task_struct * task) { down_read(&profile_rwsem); notifier_call_chain(&task_exit_notifier, 0, task); up_read(&profile_rwsem); }
functions
int profile_handoff_task(struct task_struct * task) { int ret; read_lock(&handoff_lock); ret = notifier_call_chain(&task_free_notifier, 0, task); read_unlock(&handoff_lock); return (ret == NOTIFY_OK) ? 1 : 0; }
functions
void profile_munmap(unsigned long addr) { down_read(&profile_rwsem); notifier_call_chain(&munmap_notifier, 0, (void *)addr); up_read(&profile_rwsem); }
functions
int task_handoff_register(struct notifier_block * n) { int err = -EINVAL; write_lock(&handoff_lock); err = notifier_chain_register(&task_free_notifier, n); write_unlock(&handoff_lock); return err; }
functions
int task_handoff_unregister(struct notifier_block * n) { int err = -EINVAL; write_lock(&handoff_lock); err = notifier_chain_unregister(&task_free_notifier, n); write_unlock(&handoff_lock); return err; }
functions
int profile_event_register(enum profile_type type, struct notifier_block * n) { int err = -EINVAL; down_write(&profile_rwsem); switch (type) { case PROFILE_TASK_EXIT: err = notifier_chain_register(&task_exit_notifier, n); break; case PROFILE_MUNMAP: err = notifier_chain_register(&munmap_notifier, n)...
functions
int profile_event_unregister(enum profile_type type, struct notifier_block * n) { int err = -EINVAL; down_write(&profile_rwsem); switch (type) { case PROFILE_TASK_EXIT: err = notifier_chain_unregister(&task_exit_notifier, n); break; case PROFILE_MUNMAP: err = notifier_chain_unregister(&munmap_notifi...
functions
void __profile_flip_buffers(void *unused) { int cpu = smp_processor_id(); per_cpu(cpu_profile_flip, cpu) = !per_cpu(cpu_profile_flip, cpu); }
functions
void profile_flip_buffers(void) { int i, j, cpu; down(&profile_flip_mutex); j = per_cpu(cpu_profile_flip, get_cpu()); put_cpu(); on_each_cpu(__profile_flip_buffers, NULL, 0, 1); for_each_online_cpu(cpu) { struct profile_hit *hits = per_cpu(cpu_profile_hits, cpu)[j]; for (i = 0; i < NR_PROFILE_HIT; ++i) { ...
functions
void profile_discard_flip_buffers(void) { int i, cpu; down(&profile_flip_mutex); i = per_cpu(cpu_profile_flip, get_cpu()); put_cpu(); on_each_cpu(__profile_flip_buffers, NULL, 0, 1); for_each_online_cpu(cpu) { struct profile_hit *hits = per_cpu(cpu_profile_hits, cpu)[i]; memset(hits, 0, NR_PROFILE_HIT*sizeof...
functions
void profile_hit(int type, void *__pc) { unsigned long primary, secondary, flags, pc = (unsigned long)__pc; int i, j, cpu; struct profile_hit *hits; if (prof_on != type || !prof_buffer) return; pc = min((pc - (unsigned long)_stext) >> prof_shift, prof_len - 1); i = primary = (pc & (NR_PROFILE_GRP - 1)) << PROF...
functions
else if (!hits[i + j].hits) { hits[i + j].pc = pc; hits[i + j].hits = 1; goto out; }
functions
__devinit profile_cpu_callback(struct notifier_block *info, unsigned long action, void *__cpu) { int node, cpu = (unsigned long)__cpu; struct page *page; switch (action) { case CPU_UP_PREPARE: node = cpu_to_node(cpu); per_cpu(cpu_profile_flip, cpu) = 0; if (!per_cpu(cpu_profile_hits, cpu)[1]) { page ...
functions
void profile_hit(int type, void *__pc) { unsigned long pc; if (prof_on != type || !prof_buffer) return; pc = ((unsigned long)__pc - (unsigned long)_stext) >> prof_shift; atomic_inc(&prof_buffer[min(pc, prof_len - 1)]); }
functions
void profile_tick(int type, struct pt_regs *regs) { if (type == CPU_PROFILING && timer_hook) timer_hook(regs); if (!user_mode(regs) && cpu_isset(smp_processor_id(), prof_cpu_mask)) profile_hit(type, (void *)profile_pc(regs)); }
functions
int prof_cpu_mask_read_proc (char *page, char **start, off_t off, int count, int *eof, void *data) { int len = cpumask_scnprintf(page, count, *(cpumask_t *)data); if (count - len < 2) return -EINVAL; len += sprintf(page + len, "\n"); return len; }
functions
int prof_cpu_mask_write_proc (struct file *file, const char __user *buffer, unsigned long count, void *data) { cpumask_t *mask = (cpumask_t *)data; unsigned long full_count = count, err; cpumask_t new_value; err = cpumask_parse(buffer, count, new_value); if (err) return err; *mask = new_value; return fu...
functions
void create_prof_cpu_mask(struct proc_dir_entry *root_irq_dir) { struct proc_dir_entry *entry; /* create /proc/irq/prof_cpu_mask */ if (!(entry = create_proc_entry("prof_cpu_mask", 0600, root_irq_dir))) return; entry->nlink = 1; entry->data = (void *)&prof_cpu_mask; entry->read_proc = prof_cpu_mask_read_proc; ...
functions
ssize_t read_profile(struct file *file, char __user *buf, size_t count, loff_t *ppos) { unsigned long p = *ppos; ssize_t read; char * pnt; unsigned int sample_step = 1 << prof_shift; profile_flip_buffers(); if (p >= (prof_len+1)*sizeof(unsigned int)) return 0; if (count > (prof_len+1)*sizeof(unsigned int) - p...
functions
ssize_t write_profile(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { #ifdef CONFIG_SMP extern int setup_profiling_timer (unsigned int multiplier); if (count == sizeof(int)) { unsigned int multiplier; if (copy_from_user(&multiplier, buf, sizeof(int))) return -EFAULT; if (s...
functions
__init profile_nop(void *unused) { }
functions
__init create_hash_tables(void) { int cpu; for_each_online_cpu(cpu) { int node = cpu_to_node(cpu); struct page *page; page = alloc_pages_node(node, GFP_KERNEL | __GFP_ZERO, 0); if (!page) goto out_cleanup; per_cpu(cpu_profile_hits, cpu)[1] = (struct profile_hit *)page_address(page); page = alloc_...
functions
__init create_proc_profile(void) { struct proc_dir_entry *entry; if (!prof_on) return 0; if (create_hash_tables()) return -1; if (!(entry = create_proc_entry("profile", S_IWUSR | S_IRUGO, NULL))) return 0; entry->proc_fops = &proc_profile_operations; entry->size = (1+prof_len) * sizeof(atomic_t); hotcpu_n...
includes
#include <errno.h>
includes
#include <fcntl.h>
includes
#include <string.h>
includes
#include <sys/socket.h>
includes
#include <sys/types.h>
includes
#include <grpc/support/alloc.h>
includes
#include <grpc/support/log.h>
includes
#include <grpc/support/string_util.h>
functions
void create_sockets(int sv[2]) { int flags; grpc_create_socketpair_if_unix(sv); flags = fcntl(sv[0], F_GETFL, 0); GPR_ASSERT(fcntl(sv[0], F_SETFL, flags | O_NONBLOCK) == 0); flags = fcntl(sv[1], F_GETFL, 0); GPR_ASSERT(fcntl(sv[1], F_SETFL, flags | O_NONBLOCK) == 0); GPR_ASSERT(grpc_set_socket_no_sigpipe_...
functions
grpc_endpoint_pair grpc_iomgr_create_endpoint_pair( const char *name, grpc_resource_quota *resource_quota, size_t read_slice_size) { int sv[2]; grpc_endpoint_pair p; char *final_name; create_sockets(sv); gpr_asprintf(&final_name, "%s:client", name); p.client = grpc_tcp_create(grpc_fd_create(sv[1], ...
functions
vsf_client_launch vsf_standalone_main(void) { struct vsf_sysutil_sockaddr* p_accept_addr = 0; int listen_sock = -1; int retval; s_ipaddr_size = vsf_sysutil_get_ipaddr_size(); if (tunable_listen && tunable_listen_ipv6) { die("run two copies of vsftpd for IPv4 and IPv6"); }
functions
void prepare_child(int new_client_sock) { /* We must satisfy the contract: command socket on fd 0, 1, 2 */ vsf_sysutil_dupfd2(new_client_sock, 0); #ifndef DEBUG // disable for tmp vsf_sysutil_dupfd2(new_client_sock, 1); vsf_sysutil_dupfd2(new_client_sock, 2); #endif if (new_client_sock > 2) { vsf_sysuti...
functions
void drop_ip_count(void* p_raw_addr) { unsigned int count; unsigned int* p_count = (unsigned int*)hash_lookup_entry(s_p_ip_count_hash, p_raw_addr); if (!p_count) { bug("IP address missing from hash"); }
functions
void handle_sigchld(int duff) { unsigned int reap_one = 1; (void) duff; while (reap_one) { reap_one = (unsigned int)vsf_sysutil_wait_reap_one(); if (reap_one) { struct vsf_sysutil_ipaddr* p_ip; /* Account total number of instances */ --s_children; /* Account per-IP limit */ ...
functions
void handle_sighup(int duff) { (void) duff; /* We don't crash the out the listener if an invalid config was added */ vsf_parseconf_load_file(0, 0); }
functions
int hash_ip(unsigned int buckets, void* p_key) { const unsigned char* p_raw_ip = (const unsigned char*)p_key; unsigned int val = 0; int shift = 24; unsigned int i; for (i = 0; i < s_ipaddr_size; ++i) { val ^= p_raw_ip[i] << shift; shift -= 8; if (shift < 0) { shift = 24; }
functions
int hash_pid(unsigned int buckets, void* p_key) { unsigned int* p_pid = (unsigned int*)p_key; return (*p_pid) % buckets; }
functions
int handle_ip_count(void* p_ipaddr) { unsigned int* p_count = (unsigned int*)hash_lookup_entry(s_p_ip_count_hash, p_ipaddr); unsigned int count; if (!p_count) { count = 1; hash_add_entry(s_p_ip_count_hash, p_ipaddr, (void*)&count); }
defines
#define FILECODE PROC_CPU_FAMILY_0X10_CPUF10WHEAINITDATATABLES_FILECODE
functions
VOID GetF10WheaInitData ( IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, OUT CONST VOID **F10WheaInitDataPtr, OUT UINT8 *NumberOfElements, IN AMD_CONFIG_PARAMS *StdHeader ) { *NumberOfElements = 1; *F10WheaInitDataPtr = &F10WheaInitData; }
includes
#include <crypto/internal/skcipher.h>
includes
#include <linux/err.h>
includes
#include <linux/init.h>
includes
#include <linux/kernel.h>
includes
#include <linux/module.h>
includes
#include <linux/random.h>
includes
#include <linux/spinlock.h>
includes
#include <linux/string.h>
includes
#include <linux/workqueue.h>
structs
struct chainiv_ctx { spinlock_t lock; char iv[]; };
structs
struct async_chainiv_ctx { unsigned long state; spinlock_t lock; int err; struct crypto_queue queue; struct work_struct postponed; char iv[]; };
functions
int chainiv_givencrypt(struct skcipher_givcrypt_request *req) { struct crypto_ablkcipher *geniv = skcipher_givcrypt_reqtfm(req); struct chainiv_ctx *ctx = crypto_ablkcipher_ctx(geniv); struct ablkcipher_request *subreq = skcipher_givcrypt_reqctx(req); unsigned int ivsize; int err; ablkcipher_request_set_tfm(subr...
functions
int chainiv_givencrypt_first(struct skcipher_givcrypt_request *req) { struct crypto_ablkcipher *geniv = skcipher_givcrypt_reqtfm(req); struct chainiv_ctx *ctx = crypto_ablkcipher_ctx(geniv); spin_lock_bh(&ctx->lock); if (crypto_ablkcipher_crt(geniv)->givencrypt != chainiv_givencrypt_first) goto unlock; cr...
functions
int chainiv_init_common(struct crypto_tfm *tfm) { tfm->crt_ablkcipher.reqsize = sizeof(struct ablkcipher_request); return skcipher_geniv_init(tfm); }
functions
int chainiv_init(struct crypto_tfm *tfm) { struct chainiv_ctx *ctx = crypto_tfm_ctx(tfm); spin_lock_init(&ctx->lock); return chainiv_init_common(tfm); }
functions
int async_chainiv_schedule_work(struct async_chainiv_ctx *ctx) { int queued; int err = ctx->err; if (!ctx->queue.qlen) { smp_mb__before_clear_bit(); clear_bit(CHAINIV_STATE_INUSE, &ctx->state); if (!ctx->queue.qlen || test_and_set_bit(CHAINIV_STATE_INUSE, &ctx->state)) goto out; }
functions
int async_chainiv_postpone_request(struct skcipher_givcrypt_request *req) { struct crypto_ablkcipher *geniv = skcipher_givcrypt_reqtfm(req); struct async_chainiv_ctx *ctx = crypto_ablkcipher_ctx(geniv); int err; spin_lock_bh(&ctx->lock); err = skcipher_enqueue_givcrypt(&ctx->queue, req); spin_unlock_bh(&ctx->loc...
functions
int async_chainiv_givencrypt_tail(struct skcipher_givcrypt_request *req) { struct crypto_ablkcipher *geniv = skcipher_givcrypt_reqtfm(req); struct async_chainiv_ctx *ctx = crypto_ablkcipher_ctx(geniv); struct ablkcipher_request *subreq = skcipher_givcrypt_reqctx(req); unsigned int ivsize = crypto_ablkcipher_ivsize(...
functions
int async_chainiv_givencrypt(struct skcipher_givcrypt_request *req) { struct crypto_ablkcipher *geniv = skcipher_givcrypt_reqtfm(req); struct async_chainiv_ctx *ctx = crypto_ablkcipher_ctx(geniv); struct ablkcipher_request *subreq = skcipher_givcrypt_reqctx(req); ablkcipher_request_set_tfm(subreq, skcipher_geniv_c...
functions
int async_chainiv_givencrypt_first(struct skcipher_givcrypt_request *req) { struct crypto_ablkcipher *geniv = skcipher_givcrypt_reqtfm(req); struct async_chainiv_ctx *ctx = crypto_ablkcipher_ctx(geniv); if (test_and_set_bit(CHAINIV_STATE_INUSE, &ctx->state)) goto out; if (crypto_ablkcipher_crt(geniv)->givencryp...
functions
void async_chainiv_do_postponed(struct work_struct *work) { struct async_chainiv_ctx *ctx = container_of(work, struct async_chainiv_ctx, postponed); struct skcipher_givcrypt_request *req; struct ablkcipher_request *subreq; int err; /* Only handle one request at a time to avoid hogging kevent...
functions
int async_chainiv_init(struct crypto_tfm *tfm) { struct async_chainiv_ctx *ctx = crypto_tfm_ctx(tfm); spin_lock_init(&ctx->lock); crypto_init_queue(&ctx->queue, 100); INIT_WORK(&ctx->postponed, async_chainiv_do_postponed); return chainiv_init_common(tfm); }
functions
void async_chainiv_exit(struct crypto_tfm *tfm) { struct async_chainiv_ctx *ctx = crypto_tfm_ctx(tfm); BUG_ON(test_bit(CHAINIV_STATE_INUSE, &ctx->state) || ctx->queue.qlen); skcipher_geniv_exit(tfm); }
functions
__init chainiv_module_init(void) { return crypto_register_template(&chainiv_tmpl); }
functions
void chainiv_module_exit(void) { crypto_unregister_template(&chainiv_tmpl); }
includes
#include <common.h>
includes
#include <asm/mmu.h>
includes
#include <stdio.h>
includes
#include <stdlib.h>
includes
#include <string.h>
defines
#define VMD_HEADER_SIZE 0x330
defines
#define PALETTE_COUNT 256
defines
#define QUEUE_SIZE 0x1000
defines
#define QUEUE_MASK 0x0FFF
functions
void lz_unpack(const unsigned char *src, unsigned char *dest, int dest_len) { const unsigned char *s; unsigned char *d; unsigned char *d_end; unsigned char queue[QUEUE_SIZE]; unsigned int qpos; unsigned int dataleft; unsigned int chainofs; unsigned int chainlen; unsigned int speclen;...
functions
int rle_unpack(const unsigned char *src, unsigned char *dest, int src_len, int dest_len) { const unsigned char *ps; unsigned char *pd; int i, l; unsigned char *dest_end = dest + dest_len; ps = src; pd = dest; if (src_len & 1) *pd++ = *ps++; src_len >>= 1; i = 0; do ...