• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ LIST_INIT函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中LIST_INIT函数的典型用法代码示例。如果您正苦于以下问题:C++ LIST_INIT函数的具体用法?C++ LIST_INIT怎么用?C++ LIST_INIT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了LIST_INIT函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: LIST_INIT

 * Implement search in an external script. The results are streamed
 * back into a local listing.
 */

#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/wait.h>

#include "debug.h"
#include "excrate.h"
#include "rig.h"
#include "status.h"

static struct list excrates = LIST_INIT(excrates);

static int excrate_init(struct excrate *e, const char *script,
                        const char *search, struct listing *storage)
{
    pid_t pid;

    fprintf(stderr, "External scan '%s'...\n", search);

    pid = fork_pipe_nb(&e->fd, script, "scan", search, NULL);
    if (pid == -1)
        return -1;

    e->pid = pid;
    e->pe = NULL;
    e->terminated = false;
开发者ID:xwax,项目名称:xwax,代码行数:31,代码来源:excrate.c


示例2: dhcp6_timer_init

void
dhcp6_timer_init()
{
	LIST_INIT(&timer_head);
	tm_sentinel = tm_max;
}
开发者ID:garybuhrmaster,项目名称:wide-dhcpv6,代码行数:6,代码来源:timer.c


示例3: main

/* process HTTP or SSDP requests */
int
main(int argc, char **argv)
{
	int ret, i;
	int sudp = -1, shttpl = -1;
	int smonitor = -1;
	LIST_HEAD(httplisthead, upnphttp) upnphttphead;
	struct upnphttp * e = 0;
	struct upnphttp * next;
	fd_set readset;	/* for select() */
	fd_set writeset;
	struct timeval timeout, timeofday, lastnotifytime = {0, 0};
	time_t lastupdatetime = 0;
	int max_fd = -1;
	int last_changecnt = 0;
	pid_t scanner_pid = 0;
	pthread_t inotify_thread = 0;
#ifdef TIVO_SUPPORT
	uint8_t beacon_interval = 5;
	int sbeacon = -1;
	struct sockaddr_in tivo_bcast;
	struct timeval lastbeacontime = {0, 0};
#endif

	for (i = 0; i < L_MAX; i++)
		log_level[i] = E_WARN;
#ifdef ENABLE_NLS
	setlocale(LC_MESSAGES, "");
	setlocale(LC_CTYPE, "en_US.utf8");
	DPRINTF(E_DEBUG, L_GENERAL, "Using locale dir %s\n", bindtextdomain("minidlna", getenv("TEXTDOMAINDIR")));
	textdomain("minidlna");
#endif

	ret = init(argc, argv);
	if (ret != 0)
		return 1;

	DPRINTF(E_WARN, L_GENERAL, "Starting " SERVER_NAME " version " MINIDLNA_VERSION ".\n");
	if (sqlite3_libversion_number() < 3005001)
	{
		DPRINTF(E_WARN, L_GENERAL, "SQLite library is old.  Please use version 3.5.1 or newer.\n");
	}

	LIST_INIT(&upnphttphead);

	ret = open_db(NULL);
	if (ret == 0)
	{
		updateID = sql_get_int_field(db, "SELECT VALUE from SETTINGS where KEY = 'UPDATE_ID'");
		if (updateID == -1)
			ret = -1;
	}
	check_db(db, ret, &scanner_pid);
	signal(SIGCHLD, &sigchld);
#ifdef HAVE_INOTIFY
	if( GETFLAG(INOTIFY_MASK) )
	{
		if (!sqlite3_threadsafe() || sqlite3_libversion_number() < 3005001)
			DPRINTF(E_ERROR, L_GENERAL, "SQLite library is not threadsafe!  "
			                            "Inotify will be disabled.\n");
		else if (pthread_create(&inotify_thread, NULL, start_inotify, NULL) != 0)
			DPRINTF(E_FATAL, L_GENERAL, "ERROR: pthread_create() failed for start_inotify. EXITING\n");
	}
#endif
	smonitor = OpenAndConfMonitorSocket();

	sudp = OpenAndConfSSDPReceiveSocket();
	if (sudp < 0)
	{
		DPRINTF(E_INFO, L_GENERAL, "Failed to open socket for receiving SSDP. Trying to use MiniSSDPd\n");
		if (SubmitServicesToMiniSSDPD(lan_addr[0].str, runtime_vars.port) < 0)
			DPRINTF(E_FATAL, L_GENERAL, "Failed to connect to MiniSSDPd. EXITING");
	}
	/* open socket for HTTP connections. */
	shttpl = OpenAndConfHTTPSocket(runtime_vars.port);
	if (shttpl < 0)
		DPRINTF(E_FATAL, L_GENERAL, "Failed to open socket for HTTP. EXITING\n");
	DPRINTF(E_WARN, L_GENERAL, "HTTP listening on port %d\n", runtime_vars.port);

#ifdef TIVO_SUPPORT
	if (GETFLAG(TIVO_MASK))
	{
		DPRINTF(E_WARN, L_GENERAL, "TiVo support is enabled.\n");
		/* Add TiVo-specific randomize function to sqlite */
		ret = sqlite3_create_function(db, "tivorandom", 1, SQLITE_UTF8, NULL, &TiVoRandomSeedFunc, NULL, NULL);
		if (ret != SQLITE_OK)
			DPRINTF(E_ERROR, L_TIVO, "ERROR: Failed to add sqlite randomize function for TiVo!\n");
		/* open socket for sending Tivo notifications */
		sbeacon = OpenAndConfTivoBeaconSocket();
		if(sbeacon < 0)
			DPRINTF(E_FATAL, L_GENERAL, "Failed to open sockets for sending Tivo beacon notify "
		                "messages. EXITING\n");
		tivo_bcast.sin_family = AF_INET;
		tivo_bcast.sin_addr.s_addr = htonl(getBcastAddress());
		tivo_bcast.sin_port = htons(2190);
	}
	else
		sbeacon = -1;
#endif
//.........这里部分代码省略.........
开发者ID:hedger,项目名称:minidlna-kqueue,代码行数:101,代码来源:minidlna.c


示例4: WINE_DEFAULT_DEBUG_CHANNEL

#include "gdi_private.h"
#include "wine/unicode.h"
#include "wine/list.h"
#include "wine/debug.h"

WINE_DEFAULT_DEBUG_CHANNEL(driver);

struct graphics_driver
{
    struct list             entry;
    HMODULE                 module;  /* module handle */
    DC_FUNCTIONS            funcs;
};

static struct list drivers = LIST_INIT( drivers );
static struct graphics_driver *display_driver;

static CRITICAL_SECTION driver_section;
static CRITICAL_SECTION_DEBUG critsect_debug =
{
    0, 0, &driver_section,
    { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
      0, 0, { (DWORD_PTR)(__FILE__ ": driver_section") }
};
static CRITICAL_SECTION driver_section = { &critsect_debug, -1, 0, 0, 0, 0 };

/**********************************************************************
 *	     create_driver
 *
 * Allocate and fill the driver structure for a given module.
开发者ID:carlosbislip,项目名称:wine,代码行数:30,代码来源:driver.c


示例5: dhcp6_timer_init

void dhcp6_timer_init(void)
{
    LIST_INIT(&client6_config.timer_head);
    client6_config.tm_sentinel = ULLONG_MAX;
}
开发者ID:eckyecky,项目名称:rt-n56u,代码行数:5,代码来源:timer.c


示例6: scr_hash_new

/* allocates a new hash */
scr_hash* scr_hash_new()
{
  scr_hash* hash = (scr_hash*) SCR_MALLOC(sizeof(scr_hash));
  LIST_INIT(hash);
  return hash;
}
开发者ID:LLNL,项目名称:scr,代码行数:7,代码来源:scr_hash.c


示例7: fork1

/*
 * General fork call.  Note that another LWP in the process may call exec()
 * or exit() while we are forking.  It's safe to continue here, because
 * neither operation will complete until all LWPs have exited the process.
 */
int
fork1(struct lwp *l1, int flags, int exitsig, void *stack, size_t stacksize,
    void (*func)(void *), void *arg, register_t *retval,
    struct proc **rnewprocp)
{
	struct proc	*p1, *p2, *parent;
	struct plimit   *p1_lim;
	uid_t		uid;
	struct lwp	*l2;
	int		count;
	vaddr_t		uaddr;
	int		tnprocs;
	int		tracefork;
	int		error = 0;

	p1 = l1->l_proc;
	uid = kauth_cred_getuid(l1->l_cred);
	tnprocs = atomic_inc_uint_nv(&nprocs);

	/*
	 * Although process entries are dynamically created, we still keep
	 * a global limit on the maximum number we will create.
	 */
	if (__predict_false(tnprocs >= maxproc))
		error = -1;
	else
		error = kauth_authorize_process(l1->l_cred,
		    KAUTH_PROCESS_FORK, p1, KAUTH_ARG(tnprocs), NULL, NULL);

	if (error) {
		static struct timeval lasttfm;
		atomic_dec_uint(&nprocs);
		if (ratecheck(&lasttfm, &fork_tfmrate))
			tablefull("proc", "increase kern.maxproc or NPROC");
		if (forkfsleep)
			kpause("forkmx", false, forkfsleep, NULL);
		return EAGAIN;
	}

	/*
	 * Enforce limits.
	 */
	count = chgproccnt(uid, 1);
	if (__predict_false(count > p1->p_rlimit[RLIMIT_NPROC].rlim_cur)) {
		if (kauth_authorize_process(l1->l_cred, KAUTH_PROCESS_RLIMIT,
		    p1, KAUTH_ARG(KAUTH_REQ_PROCESS_RLIMIT_BYPASS),
		    &p1->p_rlimit[RLIMIT_NPROC], KAUTH_ARG(RLIMIT_NPROC)) != 0) {
			(void)chgproccnt(uid, -1);
			atomic_dec_uint(&nprocs);
			if (forkfsleep)
				kpause("forkulim", false, forkfsleep, NULL);
			return EAGAIN;
		}
	}

	/*
	 * Allocate virtual address space for the U-area now, while it
	 * is still easy to abort the fork operation if we're out of
	 * kernel virtual address space.
	 */
	uaddr = uvm_uarea_alloc();
	if (__predict_false(uaddr == 0)) {
		(void)chgproccnt(uid, -1);
		atomic_dec_uint(&nprocs);
		return ENOMEM;
	}

	/*
	 * We are now committed to the fork.  From here on, we may
	 * block on resources, but resource allocation may NOT fail.
	 */

	/* Allocate new proc. */
	p2 = proc_alloc();

	/*
	 * Make a proc table entry for the new process.
	 * Start by zeroing the section of proc that is zero-initialized,
	 * then copy the section that is copied directly from the parent.
	 */
	memset(&p2->p_startzero, 0,
	    (unsigned) ((char *)&p2->p_endzero - (char *)&p2->p_startzero));
	memcpy(&p2->p_startcopy, &p1->p_startcopy,
	    (unsigned) ((char *)&p2->p_endcopy - (char *)&p2->p_startcopy));

	TAILQ_INIT(&p2->p_sigpend.sp_info);

	LIST_INIT(&p2->p_lwps);
	LIST_INIT(&p2->p_sigwaiters);

	/*
	 * Duplicate sub-structures as needed.
	 * Increase reference counts on shared objects.
	 * Inherit flags we want to keep.  The flags related to SIGCHLD
	 * handling are important in order to keep a consistent behaviour
//.........这里部分代码省略.........
开发者ID:yazshel,项目名称:netbsd-kernel,代码行数:101,代码来源:kern_fork.c


示例8: EXPORT_SYMBOL

 * thread.c: thread implementation
 * Refered to ReactOS code
 */
#include "mutex.h"
#include "unistr.h"
#include "attach.h"
#include "semaphore.h"
#include "thread.h"
#include "wineserver/lib.h"

#ifdef CONFIG_UNIFIED_KERNEL

POBJECT_TYPE thread_object_type = NULL;
EXPORT_SYMBOL(thread_object_type);

struct list_head  thread_list = LIST_INIT(thread_list);

static void thread_close(struct ethread *);
static int  thread_signal(struct ethread *, int);
static void thread_exit(struct ethread *, int);
static void thread_execve(struct ethread *);
static void thread_fork(struct ethread *,
		struct task_struct *,
		struct task_struct *,
		unsigned long);

extern void do_exit_task(struct task_struct *tsk, long code);
extern long do_fork_from_task(struct task_struct *ptsk,
		unsigned long process_flags,
		unsigned long clone_flags,
		unsigned long stack_start,
开发者ID:amir9,项目名称:longene,代码行数:31,代码来源:thread.c


示例9: rsys_init

int rsys_init(struct rsys* rsys, struct rsys_table* table, struct esys* esys)
{
    if(rsys->magic == OCN_MAGIC)
        return OCN_FAIL;

    /* rendersystem table */
    rsys->table = *table;

    if(rsys->table.win_init != NULL)
        if(rsys->table.win_init() != OCN_OK)
            return OCN_WINDOW_ERR_CREATE;

    if(rsys->table.ctt1_init != NULL)
    {
        if(rsys->table.ctt1_init() != OCN_OK)
        {
            if(rsys->table.win_dest != NULL)
                rsys->table.win_dest();
            return OCN_CONTEXT_ERR_CREATE;
        }
    }

    if(rsys->table.ctt2_init != NULL)
    {
        if(rsys->table.ctt2_init() != OCN_OK)
        {
            if(rsys->table.ctt1_dest != NULL)
                rsys->table.ctt1_dest();
            if(rsys->table.win_dest != NULL)
                rsys->table.win_dest();
            return OCN_CONTEXT_ERR_CREATE;
        }
    }

    if(rsys->table.glew_init != NULL)
    {
        if(rsys->table.glew_init() != OCN_OK)
        {
            if(rsys->table.ctt1_dest != NULL)
                rsys->table.ctt1_dest();
            if(rsys->table.ctt2_dest != NULL)
                rsys->table.ctt2_dest();
            if(rsys->table.win_dest != NULL)
                rsys->table.win_dest();
            return OCN_GLEW_ERR;
        }
    }

    /* render queue */
    ocn_spin_init(&rsys->render_reqs_lock);
    queue_init   (&rsys->render_reqs, OCN_RSYS_BUFFER_SIZE);

    /* worker queue */
    ocn_spin_init(&rsys->worker_reqs_lock);
    queue_init   (&rsys->worker_reqs, OCN_RSYS_BUFFER_SIZE);

    ocn_thread_create(&rsys->worker_thread, rsys_worker, rsys);
    ocn_thread_create(&rsys->render_thread, rsys_render, rsys);

    /* ro_assets */
    ocn_spin_init(&rsys->ro_assets_lock);
    for(uint64_t u = 0lu; u < OCN_MAX_ASSETS; u++)
        rsys->ro_assets[u].flags = 0lu;

    /* ro_entities */
    ocn_spin_init(&rsys->ro_entities_lock);
    for(uint64_t u = 0lu; u < OCN_MAX_ENTITIES; u++)
        rsys->ro_entities[u].flags = 0lu;

    LIST_INIT(&rsys->ros)

    frame_init(&rsys->frame);

    rsys->bg_red   = 0.5f;
    rsys->bg_green = 0.5f;
    rsys->bg_blue  = 0.5f;
    rsys->bg_alpha = 1.0f;

    rsys->magic = OCN_MAGIC;

    return OCN_OK;
}
开发者ID:onixion,项目名称:pandarus,代码行数:82,代码来源:rsys.c


示例10: LIST_INIT

	uint32_t dev_class;

	uint32_t reg_base[6];
	uint32_t reg_size[6];
	uint8_t irq_line;
	uint8_t irq_pin;

	struct list link;
};

struct pci_bus {
	struct pci_func *parent_bridge;
	uint32_t busno;
};

static struct list pci_func_list = LIST_INIT(pci_func_list);
static paddr_t pci_map_base = CONFIG_PCI_MMIO_ALLOC_BASE;

static void
pci_conf1_set_addr(uint32_t bus,
		   uint32_t dev,
		   uint32_t func,
		   uint32_t offset)
{
	ASSERT(bus < 256);
	ASSERT(dev < 32);
	ASSERT(func < 8);
	ASSERT(offset < 256);
	ASSERT((offset & 0x3) == 0);

	uint32_t v = (1 << 31) |	/* config-space */
开发者ID:m943040028,项目名称:prex,代码行数:31,代码来源:pci.c


示例11: SAMPLE

#include "external.h"
#include "list.h"
#include "realtime.h"
#include "rig.h"
#include "status.h"
#include "track.h"

#define RATE 44100

#define SAMPLE (sizeof(signed short) * TRACK_CHANNELS) /* bytes per sample */
#define TRACK_BLOCK_PCM_BYTES (TRACK_BLOCK_SAMPLES * SAMPLE)

#define _STR(tok) #tok
#define STR(tok) _STR(tok)

static struct list tracks = LIST_INIT(tracks);
static bool use_mlock = false;

/*
 * An empty track is used rarely, and is easier than
 * continuous checks for NULL throughout the code
 */

static struct track empty = {
    .refcount = 1,

    .rate = RATE,
    .bytes = 0,
    .length = 0,
    .blocks = 0,
开发者ID:n3uromanc3r,项目名称:xwax,代码行数:30,代码来源:track.c


示例12: pppattach

/*
 * Called from boot code to establish ppp interfaces.
 */
void
pppattach()
{
    LIST_INIT(&ppp_softc_list);
    if_clone_attach(&ppp_cloner);
}
开发者ID:genua,项目名称:anoubis_os,代码行数:9,代码来源:if_ppp.c


示例13: main

int
main(
	int argc,
	char **argv)
{
	extern char *optarg;
	CLIENT *cl;
	int ch, ret;
	char *passwd;

	prog = argv[0];

	version_check();

	/*
	 * Check whether another server is running or not.  There
	 * is a race condition where two servers could be racing to
	 * register with the portmapper.  The goal of this check is to
	 * forbid running additional servers (like those started from
	 * the test suite) if the user is already running one.
	 *
	 * XXX
	 * This does not solve nor prevent two servers from being
	 * started at the same time and running recovery at the same
	 * time on the same environments.
	 */
	if ((cl = clnt_create("localhost",
	    DB_RPC_SERVERPROG, DB_RPC_SERVERVERS, "tcp")) != NULL) {
		fprintf(stderr,
		    "%s: Berkeley DB RPC server already running.\n", prog);
		clnt_destroy(cl);
		return (EXIT_FAILURE);
	}

	LIST_INIT(&__dbsrv_home);
	while ((ch = getopt(argc, argv, "h:I:L:P:t:T:Vv")) != EOF)
		switch (ch) {
		case 'h':
			(void)add_home(optarg);
			break;
		case 'I':
			if (__db_getlong(NULL, prog,
			    optarg, 1, LONG_MAX, &__dbsrv_idleto))
				return (EXIT_FAILURE);
			break;
		case 'L':
			logfile = optarg;
			break;
		case 'P':
			passwd = strdup(optarg);
			memset(optarg, 0, strlen(optarg));
			if (passwd == NULL) {
				fprintf(stderr, "%s: strdup: %s\n",
				    prog, strerror(errno));
				return (EXIT_FAILURE);
			}
			if ((ret = add_passwd(passwd)) != 0) {
				fprintf(stderr, "%s: strdup: %s\n",
				    prog, strerror(ret));
				return (EXIT_FAILURE);
			}
			break;
		case 't':
			if (__db_getlong(NULL, prog,
			    optarg, 1, LONG_MAX, &__dbsrv_defto))
				return (EXIT_FAILURE);
			break;
		case 'T':
			if (__db_getlong(NULL, prog,
			    optarg, 1, LONG_MAX, &__dbsrv_maxto))
				return (EXIT_FAILURE);
			break;
		case 'V':
			printf("%s\n", db_version(NULL, NULL, NULL));
			return (EXIT_SUCCESS);
		case 'v':
			__dbsrv_verbose = 1;
			break;
		default:
			usage(prog);
		}
	/*
	 * Check default timeout against maximum timeout
	 */
	if (__dbsrv_defto > __dbsrv_maxto)
		__dbsrv_defto = __dbsrv_maxto;

	/*
	 * Check default timeout against idle timeout
	 * It would be bad to timeout environments sooner than txns.
	 */
	if (__dbsrv_defto > __dbsrv_idleto)
		fprintf(stderr,
		    "%s: WARNING: Idle timeout %ld is less than resource timeout %ld\n",
		    prog, __dbsrv_idleto, __dbsrv_defto);

	LIST_INIT(&__dbsrv_head);

	/*
	 * If a client crashes during an RPC, our reply to it
//.........这里部分代码省略.........
开发者ID:dmeister,项目名称:kbdb,代码行数:101,代码来源:db_server_cxxutil.cpp


示例14: init_new_proxy

/* Perform the most basic initialization of a proxy :
 * memset(), list_init(*), reset_timeouts(*).
 * Any new proxy or peer should be initialized via this function.
 */
void init_new_proxy(struct proxy *p)
{
	memset(p, 0, sizeof(struct proxy));
	LIST_INIT(&p->pendconns);
	LIST_INIT(&p->acl);
	LIST_INIT(&p->http_req_rules);
	LIST_INIT(&p->block_cond);
	LIST_INIT(&p->redirect_rules);
	LIST_INIT(&p->mon_fail_cond);
	LIST_INIT(&p->switching_rules);
	LIST_INIT(&p->server_rules);
	LIST_INIT(&p->persist_rules);
	LIST_INIT(&p->sticking_rules);
	LIST_INIT(&p->storersp_rules);
	LIST_INIT(&p->tcp_req.inspect_rules);
	LIST_INIT(&p->tcp_rep.inspect_rules);
	LIST_INIT(&p->tcp_req.l4_rules);
	LIST_INIT(&p->req_add);
	LIST_INIT(&p->rsp_add);
	LIST_INIT(&p->listener_queue);
	LIST_INIT(&p->logsrvs);
	LIST_INIT(&p->logformat);
	LIST_INIT(&p->format_unique_id);

	/* Timeouts are defined as -1 */
	proxy_reset_timeouts(p);
	p->tcp_rep.inspect_delay = TICK_ETERNITY;
}
开发者ID:BeachheadStudio,项目名称:haproxy,代码行数:32,代码来源:proxy.c


示例15: vmem_init

vmem_t *
vmem_init(vmem_t *vm, const char *name,
    vmem_addr_t base, vmem_size_t size, vmem_size_t quantum,
    vmem_import_t *importfn, vmem_release_t *releasefn,
    vmem_t *arg, vmem_size_t qcache_max, vm_flag_t flags, int ipl)
{
	int i;

	KASSERT((flags & (VM_SLEEP|VM_NOSLEEP)) != 0);
	KASSERT((~flags & (VM_SLEEP|VM_NOSLEEP)) != 0);
	KASSERT(quantum > 0);

#if defined(_KERNEL)
	/* XXX: SMP, we get called early... */
	if (!vmem_bootstrapped) {
		vmem_bootstrap();
	}
#endif /* defined(_KERNEL) */

	if (vm == NULL) {
		vm = xmalloc(sizeof(*vm), flags);
	}
	if (vm == NULL) {
		return NULL;
	}

	VMEM_CONDVAR_INIT(vm, "vmem");
	VMEM_LOCK_INIT(vm, ipl);
	vm->vm_flags = flags;
	vm->vm_nfreetags = 0;
	LIST_INIT(&vm->vm_freetags);
	strlcpy(vm->vm_name, name, sizeof(vm->vm_name));
	vm->vm_quantum_mask = quantum - 1;
	vm->vm_quantum_shift = SIZE2ORDER(quantum);
	KASSERT(ORDER2SIZE(vm->vm_quantum_shift) == quantum);
	vm->vm_importfn = importfn;
	vm->vm_releasefn = releasefn;
	vm->vm_arg = arg;
	vm->vm_nbusytag = 0;
	vm->vm_size = 0;
	vm->vm_inuse = 0;
#if defined(QCACHE)
	qc_init(vm, qcache_max, ipl);
#endif /* defined(QCACHE) */

	TAILQ_INIT(&vm->vm_seglist);
	for (i = 0; i < VMEM_MAXORDER; i++) {
		LIST_INIT(&vm->vm_freelist[i]);
	}
	memset(&vm->vm_hash0, 0, sizeof(struct vmem_hashlist));
	vm->vm_hashsize = 1;
	vm->vm_hashlist = &vm->vm_hash0;

	if (size != 0) {
		if (vmem_add(vm, base, size, flags) != 0) {
			vmem_destroy1(vm);
			return NULL;
		}
	}

#if defined(_KERNEL)
	if (flags & VM_BOOTSTRAP) {
		bt_refill(vm);
	}

	mutex_enter(&vmem_list_lock);
	LIST_INSERT_HEAD(&vmem_list, vm, vm_alllist);
	mutex_exit(&vmem_list_lock);
#endif /* defined(_KERNEL) */

	return vm;
}
开发者ID:ryo,项目名称:netbsd-src,代码行数:72,代码来源:subr_vmem.c


示例16: WINE_DEFAULT_DEBUG_CHANNEL

WINE_DEFAULT_DEBUG_CHANNEL(explorer);

#ifdef HAVE_LIBHAL

#include <dbus/dbus.h>
#include <hal/libhal.h>

struct dos_drive
{
    struct list entry;
    char *udi;
    int   drive;
};

static struct list drives_list = LIST_INIT(drives_list);


#define DBUS_FUNCS \
    DO_FUNC(dbus_bus_get); \
    DO_FUNC(dbus_connection_close); \
    DO_FUNC(dbus_connection_read_write_dispatch); \
    DO_FUNC(dbus_error_init); \
    DO_FUNC(dbus_error_free); \
    DO_FUNC(dbus_error_is_set)

#define HAL_FUNCS \
    DO_FUNC(libhal_ctx_free); \
    DO_FUNC(libhal_ctx_init); \
    DO_FUNC(libhal_ctx_new); \
    DO_FUNC(libhal_ctx_set_dbus_connection); \
开发者ID:howard5888,项目名称:wineT,代码行数:30,代码来源:hal.c


示例17: usb_attach_sub

/*------------------------------------------------------------------------*
 *	usb_attach_sub
 *
 * This function creates a thread which runs the USB attach code.
 *------------------------------------------------------------------------*/
static void
usb_attach_sub(device_t dev, struct usb_bus *bus)
{
	mtx_lock(&Giant);
	if (usb_devclass_ptr == NULL)
		usb_devclass_ptr = devclass_find("usbus");
	mtx_unlock(&Giant);

#if USB_HAVE_PF
	usbpf_attach(bus);
#endif
	/* Initialise USB process messages */
	bus->explore_msg[0].hdr.pm_callback = &usb_bus_explore;
	bus->explore_msg[0].bus = bus;
	bus->explore_msg[1].hdr.pm_callback = &usb_bus_explore;
	bus->explore_msg[1].bus = bus;

	bus->detach_msg[0].hdr.pm_callback = &usb_bus_detach;
	bus->detach_msg[0].bus = bus;
	bus->detach_msg[1].hdr.pm_callback = &usb_bus_detach;
	bus->detach_msg[1].bus = bus;

	bus->attach_msg[0].hdr.pm_callback = &usb_bus_attach;
	bus->attach_msg[0].bus = bus;
	bus->attach_msg[1].hdr.pm_callback = &usb_bus_attach;
	bus->attach_msg[1].bus = bus;

	bus->suspend_msg[0].hdr.pm_callback = &usb_bus_suspend;
	bus->suspend_msg[0].bus = bus;
	bus->suspend_msg[1].hdr.pm_callback = &usb_bus_suspend;
	bus->suspend_msg[1].bus = bus;

	bus->resume_msg[0].hdr.pm_callback = &usb_bus_resume;
	bus->resume_msg[0].bus = bus;
	bus->resume_msg[1].hdr.pm_callback = &usb_bus_resume;
	bus->resume_msg[1].bus = bus;

	bus->reset_msg[0].hdr.pm_callback = &usb_bus_reset;
	bus->reset_msg[0].bus = bus;
	bus->reset_msg[1].hdr.pm_callback = &usb_bus_reset;
	bus->reset_msg[1].bus = bus;

	bus->shutdown_msg[0].hdr.pm_callback = &usb_bus_shutdown;
	bus->shutdown_msg[0].bus = bus;
	bus->shutdown_msg[1].hdr.pm_callback = &usb_bus_shutdown;
	bus->shutdown_msg[1].bus = bus;

#if USB_HAVE_UGEN
	LIST_INIT(&bus->pd_cleanup_list);
	bus->cleanup_msg[0].hdr.pm_callback = &usb_bus_cleanup;
	bus->cleanup_msg[0].bus = bus;
	bus->cleanup_msg[1].hdr.pm_callback = &usb_bus_cleanup;
	bus->cleanup_msg[1].bus = bus;
#endif

#if USB_HAVE_PER_BUS_PROCESS
	/* Create USB explore and callback processes */

	if (usb_proc_create(USB_BUS_GIANT_PROC(bus),
	    &bus->bus_mtx, device_get_nameunit(dev), USB_PRI_MED)) {
		device_printf(dev, "WARNING: Creation of USB Giant "
		    "callback process failed.\n");
	} else if (usb_proc_create(USB_BUS_NON_GIANT_ISOC_PROC(bus),
	    &bus->bus_mtx, device_get_nameunit(dev), USB_PRI_HIGHEST)) {
		device_printf(dev, "WARNING: Creation of USB non-Giant ISOC "
		    "callback process failed.\n");
	} else if (usb_proc_create(USB_BUS_NON_GIANT_BULK_PROC(bus),
	    &bus->bus_mtx, device_get_nameunit(dev), USB_PRI_HIGH)) {
		device_printf(dev, "WARNING: Creation of USB non-Giant BULK "
		    "callback process failed.\n");
	} else if (usb_proc_create(USB_BUS_EXPLORE_PROC(bus),
	    &bus->bus_mtx, device_get_nameunit(dev), USB_PRI_MED)) {
		device_printf(dev, "WARNING: Creation of USB explore "
		    "process failed.\n");
	} else if (usb_proc_create(USB_BUS_CONTROL_XFER_PROC(bus),
	    &bus->bus_mtx, device_get_nameunit(dev), USB_PRI_MED)) {
		device_printf(dev, "WARNING: Creation of USB control transfer "
		    "process failed.\n");
	} else
#endif
	{
		/* Get final attach going */
		USB_BUS_LOCK(bus);
		usb_proc_msignal(USB_BUS_EXPLORE_PROC(bus),
		    &bus->attach_msg[0], &bus->attach_msg[1]);
		USB_BUS_UNLOCK(bus);

		/* Do initial explore */
		usb_needs_explore(bus, 1);
	}
}
开发者ID:FreeBSDFoundation,项目名称:freebsd,代码行数:96,代码来源:usb_controller.c


示例18: pw_gidpolicy

static          uid_t
pw_gidpolicy(struct cargs * args, char *nam, gid_t prefer)
{
	struct group   *grp;
	gid_t           gid = (uid_t) - 1;
	struct carg    *a_gid = getarg(args, 'g');
	struct userconf	*cnf = conf.userconf;

	/*
	 * If no arg given, see if default can help out
	 */
	if (a_gid == NULL && cnf->default_group && *cnf->default_group)
		a_gid = addarg(args, 'g', cnf->default_group);

	/*
	 * Check the given gid, if any
	 */
	SETGRENT();
	if (a_gid != NULL) {
		if ((grp = GETGRNAM(a_gid->val)) == NULL) {
			gid = (gid_t) atol(a_gid->val);
			if ((gid == 0 && !isdigit((unsigned char)*a_gid->val)) || (grp = GETGRGID(gid)) == NULL)
				errx(EX_NOUSER, "group `%s' is not defined", a_gid->val);
		}
		gid = grp->gr_gid;
	} else if ((grp = GETGRNAM(nam)) != NULL &&
	    (grp->gr_mem == NULL || grp->gr_mem[0] == NULL)) {
		gid = grp->gr_gid;  /* Already created? Use it anyway... */
	} else {
		struct cargs    grpargs;
		char            tmp[32];

		LIST_INIT(&grpargs);

		/*
		 * We need to auto-create a group with the user's name. We
		 * can send all the appropriate output to our sister routine
		 * bit first see if we can create a group with gid==uid so we
		 * can keep the user and group ids in sync. We purposely do
		 * NOT check the gid range if we can force the sync. If the
		 * user's name dups an existing group, then the group add
		 * function will happily handle that case for us and exit.
		 */
		if (GETGRGID(prefer) == NULL) {
			snprintf(tmp, sizeof(tmp), "%u", prefer);
			addarg(&grpargs, 'g', tmp);
		}
		if (conf.dryrun) {
			addarg(&grpargs, 'q', NULL);
			gid = pw_group(M_NEXT, nam, -1, &grpargs);
		}
		else
		{
			pw_group(M_ADD, nam, -1, &grpargs);
			if ((grp = GETGRNAM(nam)) != NULL)
				gid = grp->gr_gid;
		}
		a_gid = LIST_FIRST(&grpargs);
		while (a_gid != NULL) {
			struct carg    *t = LIST_NEXT(a_gid, list);
			LIST_REMOVE(a_gid, list);
			a_gid = t;
		}
	}
	ENDGRENT();
	return gid;
}
开发者ID:fengsi,项目名称:freebsd,代码行数:67,代码来源:pw_user.c


示例19: LIST_INIT

    0, 0, &uuid_cs,
    { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
      0, 0, { (DWORD_PTR)(__FILE__ ": uuid_cs") }
};
static CRITICAL_SECTION uuid_cs = { &critsect_debug, -1, 0, 0, 0, 0 };

static CRITICAL_SECTION threaddata_cs;
static CRITICAL_SECTION_DEBUG threaddata_cs_debug =
{
    0, 0, &threaddata_cs,
    { &threaddata_cs_debug.ProcessLocksList, &threaddata_cs_debug.ProcessLocksList },
      0, 0, { (DWORD_PTR)(__FILE__ ": threaddata_cs") }
};
static CRITICAL_SECTION threaddata_cs = { &threaddata_cs_debug, -1, 0, 0, 0, 0 };

static struct list threaddata_list = LIST_INIT(threaddata_list);

struct context_handle_list
{
    struct context_handle_list *next;
    NDR_SCONTEXT context_handle;
};

struct threaddata
{
    struct list entry;
    CRITICAL_SECTION cs;
    DWORD thread_id;
    RpcConnection *connection;
    RpcBinding *server_binding;
    struct context_handle_list *context_handle_list;
开发者ID:hoangduit,项目名称:reactos,代码行数:31,代码来源:rpcrt4_main.c


示例20: LIST_INIT

static int dirty_rect_counter = 0;


struct surface {
	SDL_Surface *surf;
};

typedef struct {
	list_elm_t elm;
	const sprite_t *sprite;
	const sprite_t *mask;
	int color_off;
	surface_t *surface;
} cached_surface_t;

static list_t transp_sprite_cache = LIST_INIT(transp_sprite_cache);
static list_t overlay_sprite_cache = LIST_INIT(overlay_sprite_cache);
static list_t masked_sprite_cache = LIST_INIT(masked_sprite_cache);


int
sdl_init()
{
	/* Initialize defaults and Video subsystem */
	if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0) {
		LOGE("Unable to initialize SDL: %s.", SDL_GetError());
		return -1;
	}

	/* Display program name and version in caption */
	char caption[64];
开发者ID:philipphenkel,项目名称:freeserf,代码行数:31,代码来源:renderer_sdl.c



注:本文中的LIST_INIT函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ LIST_INSERT_HEAD函数代码示例发布时间:2022-05-30
下一篇:
C++ LIST_HEAD_INITIALIZER函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap