本文整理汇总了C++中bufinit函数的典型用法代码示例。如果您正苦于以下问题:C++ bufinit函数的具体用法?C++ bufinit怎么用?C++ bufinit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bufinit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cpu_startup
void
cpu_startup()
{
vaddr_t minaddr, maxaddr;
/*
* Good {morning,afternoon,evening,night}.
*/
printf(version);
printf("real mem = %lu (%luMB)\n", ptoa(physmem),
ptoa(physmem)/1024/1024);
/*
* Grab machine dependent memory spaces
*/
platform->startup();
/*
* Allocate a submap for exec arguments. This map effectively
* limits the number of processes exec'ing at any time.
*/
minaddr = vm_map_min(kernel_map);
exec_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
16 * NCARGS, VM_MAP_PAGEABLE, FALSE, NULL);
/*
* Allocate map for physio.
*/
phys_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
VM_PHYS_SIZE, 0, FALSE, NULL);
printf("avail mem = %lu (%luMB)\n", ptoa(uvmexp.free),
ptoa(uvmexp.free)/1024/1024);
/*
* Set up buffers, so they can be used to read disk labels.
*/
bufinit();
/*
* Configure the system.
*/
if (boothowto & RB_CONFIG) {
#ifdef BOOT_CONFIG
user_config();
#else
printf("kernel does not support -c; continuing..\n");
#endif
}
}
示例2: print_mdoc_head
/* ARGSUSED */
static void
print_mdoc_head(MDOC_ARGS)
{
print_gen_head(h);
bufinit(h);
bufcat_fmt(h, "%s(%s)", m->title, m->msec);
if (m->arch)
bufcat_fmt(h, " (%s)", m->arch);
print_otag(h, TAG_TITLE, 0, NULL);
print_text(h, h->buf);
}
示例3: STARTUP
/*
* initialisation function
* We start here as soon as we have a stack.
* Here we initialize the various systems
* and devices that need to be initialized.
*/
STARTUP(void kmain())
{
// TODO: move these to the appropriate headers
void vtinit();
void grayinit();
void loadavinit();
void battinit();
void usageinit();
void bogomips();
calloutinit();
lcdinit();
meminit();
grayinit();
vtinit();
linkinit();
audioinit();
sched_init();
procinit();
bufinit();
flashinit();
inodeinit();
loadavinit();
battinit();
usageinit();
#if 1
kprintf("%s build %s\n", uname_sysname, uname_version);
#else
kprintf("%s v%s\n", uname_sysname, uname_release);
kputs(
"Copyright 2005-2011 Christopher Williams <[email protected]>\n"
"Some portions copyright 2003, 2005 PpHd\n"
"\n"
"This program comes with ABSOLUTELY NO WARRANTY.\n"
"You may redistribute copies of this program\n"
"under the terms of the GNU General Public License.\n"
"\n");
#endif
if (realtime.tv_sec < 1000000000L) { /* before ~2001 */
extern const unsigned long build_date;
realtime.tv_sec = build_date;
realtime.tv_nsec = 0;
}
G.seconds = realtime.tv_sec;
uptime.tv_sec = uptime.tv_nsec = 0;
spl0();
bogomips();
}
示例4: mdoc_nm_pre
static int
mdoc_nm_pre(MDOC_ARGS)
{
struct htmlpair tag;
struct roffsu su;
int len;
switch (n->type) {
case MDOC_ELEM:
synopsis_pre(h, n);
PAIR_CLASS_INIT(&tag, "name");
print_otag(h, TAG_B, 1, &tag);
if (NULL == n->child && meta->name)
print_text(h, meta->name);
return(1);
case MDOC_HEAD:
print_otag(h, TAG_TD, 0, NULL);
if (NULL == n->child && meta->name)
print_text(h, meta->name);
return(1);
case MDOC_BODY:
print_otag(h, TAG_TD, 0, NULL);
return(1);
default:
break;
}
synopsis_pre(h, n);
PAIR_CLASS_INIT(&tag, "synopsis");
print_otag(h, TAG_TABLE, 1, &tag);
for (len = 0, n = n->child; n; n = n->next)
if (MDOC_TEXT == n->type)
len += html_strlen(n->string);
if (0 == len && meta->name)
len = html_strlen(meta->name);
SCALE_HS_INIT(&su, len);
bufinit(h);
bufcat_su(h, "width", &su);
PAIR_STYLE_INIT(&tag, h);
print_otag(h, TAG_COL, 1, &tag);
print_otag(h, TAG_COL, 0, NULL);
print_otag(h, TAG_TBODY, 0, NULL);
print_otag(h, TAG_TR, 0, NULL);
return(1);
}
示例5: errhandler
static void errhandler(struct muth *muth, va_list args)
{
vavar(FILE *, in);
char buf[1024];
char *p;
bufinit(buf);
while(fgets(buf, sizeof(buf), in) != NULL) {
p = buf + strlen(buf) - 1;
while((p >= buf) && (*p == '\n'))
*(p--) = 0;
if(buf[0])
flog(LOG_INFO, "child said: %s", buf);
}
fclose(in);
}
示例6: x86_64_bufinit
/*
* XXX Finish up the deferred buffer cache allocation and initialization.
*/
void
x86_64_bufinit()
{
int i, base, residual;
base = bufpages / nbuf;
residual = bufpages % nbuf;
for (i = 0; i < nbuf; i++) {
vsize_t curbufsize;
vaddr_t curbuf;
struct vm_page *pg;
/*
* Each buffer has MAXBSIZE bytes of VM space allocated. Of
* that MAXBSIZE space, we allocate and map (base+1) pages
* for the first "residual" buffers, and then we allocate
* "base" pages for the rest.
*/
curbuf = (vaddr_t) buffers + (i * MAXBSIZE);
curbufsize = PAGE_SIZE * ((i < residual) ? (base+1) : base);
while (curbufsize) {
/*
* Attempt to allocate buffers from the first
* 16M of RAM to avoid bouncing file system
* transfers.
*/
pg = uvm_pagealloc_strat(NULL, 0, NULL, 0,
UVM_PGA_STRAT_FALLBACK, VM_FREELIST_FIRST16);
if (pg == NULL)
panic("cpu_startup: not enough memory for "
"buffer cache");
pmap_kenter_pa(curbuf, VM_PAGE_TO_PHYS(pg),
VM_PROT_READ|VM_PROT_WRITE);
curbuf += PAGE_SIZE;
curbufsize -= PAGE_SIZE;
}
}
/*
* Set up buffers, so they can be used to read disk labels.
*/
bufinit();
}
示例7: mdoc_sx_pre
/* ARGSUSED */
static int
mdoc_sx_pre(MDOC_ARGS)
{
struct htmlpair tag[2];
bufinit(h);
bufcat(h, "#x");
for (n = n->child; n; n = n->next) {
bufcat_id(h, n->string);
if (n->next)
bufcat_id(h, " ");
}
PAIR_CLASS_INIT(&tag[0], "link-sec");
PAIR_HREF_INIT(&tag[1], h->buf);
print_otag(h, TAG_I, 1, tag);
print_otag(h, TAG_A, 2, tag);
return(1);
}
示例8: cpu_startup
static void
cpu_startup(void *dummy)
{
if (boothowto & RB_VERBOSE)
bootverbose++;
printf("real memory = %ju (%juK bytes)\n", ptoa((uintmax_t)realmem),
ptoa((uintmax_t)realmem) / 1024);
/*
* Display any holes after the first chunk of extended memory.
*/
if (bootverbose) {
int indx;
printf("Physical memory chunk(s):\n");
for (indx = 0; phys_avail[indx + 1] != 0; indx += 2) {
vm_paddr_t size1 = phys_avail[indx + 1] - phys_avail[indx];
printf("0x%08jx - 0x%08jx, %ju bytes (%ju pages)\n",
(uintmax_t)phys_avail[indx],
(uintmax_t)phys_avail[indx + 1] - 1,
(uintmax_t)size1,
(uintmax_t)size1 / PAGE_SIZE);
}
}
vm_ksubmap_init(&kmi);
printf("avail memory = %ju (%juMB)\n",
ptoa((uintmax_t)cnt.v_free_count),
ptoa((uintmax_t)cnt.v_free_count) / 1048576);
cpu_init_interrupts();
/*
* Set up buffers, so they can be used to read disk labels.
*/
bufinit();
vm_pager_bufferinit();
}
示例9: man_RS_pre
static int
man_RS_pre(MAN_ARGS)
{
struct htmlpair tag;
struct roffsu su;
if (MAN_HEAD == n->type)
return(0);
else if (MAN_BODY == n->type)
return(1);
SCALE_HS_INIT(&su, INDENT);
if (n->head->child)
a2width(n->head->child, &su);
bufinit(h);
bufcat_su(h, "margin-left", &su);
PAIR_STYLE_INIT(&tag, h);
print_otag(h, TAG_DIV, 1, &tag);
return(1);
}
示例10: cpu_booke_startup
static void
cpu_booke_startup(void *dummy)
{
int indx;
unsigned long size;
/* Initialise the decrementer-based clock. */
decr_init();
/* Good {morning,afternoon,evening,night}. */
cpu_setup(PCPU_GET(cpuid));
printf("real memory = %lu (%ld MB)\n", ptoa(physmem),
ptoa(physmem) / 1048576);
realmem = physmem;
/* Display any holes after the first chunk of extended memory. */
if (bootverbose) {
printf("Physical memory chunk(s):\n");
for (indx = 0; phys_avail[indx + 1] != 0; indx += 2) {
size = phys_avail[indx + 1] - phys_avail[indx];
printf("0x%08x - 0x%08x, %lu bytes (%lu pages)\n",
phys_avail[indx], phys_avail[indx + 1] - 1,
size, size / PAGE_SIZE);
}
}
vm_ksubmap_init(&kmi);
printf("avail memory = %lu (%ld MB)\n", ptoa(vm_cnt.v_free_count),
ptoa(vm_cnt.v_free_count) / 1048576);
/* Set up buffers, so they can be used to read disk labels. */
bufinit();
vm_pager_bufferinit();
/* Cpu supports execution permissions on the pages. */
elf32_nxstack = 1;
}
示例11: sendreq2
int sendreq2(int sock, struct hthead *req, int fd, int flags)
{
int ret, i;
struct charbuf buf;
bufinit(buf);
bufcatstr2(buf, req->method);
bufcatstr2(buf, req->url);
bufcatstr2(buf, req->ver);
bufcatstr2(buf, req->rest);
for(i = 0; i < req->noheaders; i++) {
bufcatstr2(buf, req->headers[i][0]);
bufcatstr2(buf, req->headers[i][1]);
}
bufcatstr2(buf, "");
ret = sendfd2(sock, fd, buf.b, buf.d, flags);
buffree(buf);
if(ret < 0)
return(-1);
else
return(0);
}
示例12: mdoc_ss_pre
/* ARGSUSED */
static int
mdoc_ss_pre(MDOC_ARGS)
{
struct htmlpair tag;
if (MDOC_BLOCK == n->type) {
PAIR_CLASS_INIT(&tag, "subsection");
print_otag(h, TAG_DIV, 1, &tag);
return(1);
} else if (MDOC_BODY == n->type)
return(1);
bufinit(h);
for (n = n->child; n; n = n->next) {
bufcat_id(h, n->string);
if (n->next)
bufcat_id(h, " ");
}
PAIR_ID_INIT(&tag, h->buf);
print_otag(h, TAG_H2, 1, &tag);
return(1);
}
示例13: buffmt_includes
void
buffmt_includes(struct html *h, const char *name)
{
const char *p, *pp;
pp = h->base_includes;
bufinit(h);
while (NULL != (p = strchr(pp, '%'))) {
bufncat(h, pp, (size_t)(p - pp));
switch (*(p + 1)) {
case('I'):
bufcat(h, name);
break;
default:
bufncat(h, p, 2);
break;
}
pp = p + 2;
}
if (pp)
bufcat(h, pp);
}
示例14: bsd_bufferinit
void
bsd_bufferinit()
{
kern_return_t ret;
cons.t_dev = makedev(12, 0);
bsd_startupearly();
ret = kmem_suballoc(kernel_map,
(vm_offset_t *) &mbutl,
(vm_size_t) (nmbclusters * MCLBYTES),
FALSE,
TRUE,
&mb_map);
if (ret != KERN_SUCCESS)
panic("Failed to allocate mb_map\n");
/*
* Set up buffers, so they can be used to read disk labels.
*/
bufinit();
}
示例15: cpu_startup
//.........这里部分代码省略.........
case 0: p = "1.0"; break;
case 4: p = "1.1"; break;
case 8: p = "2.0"; break;
default: p = "?.?"; break;
}
/* my babe said: 6010, 481, 0, 0, 77b657b1, 0, 4 */
sprintf(cpu_model, "HP9000/%s PA-RISC %s",
bip->bi_name, p);
} else
sprintf(cpu_model, "HP9000/(UNKNOWN %x)", i);
printf("%s\n", cpu_model);
}
printf("real mem = %d (%d reserved for PROM, %d used by OpenBSD)\n",
ctob(totalphysmem), ctob(resvmem), ctob(physmem));
/*
* Now allocate buffers proper. They are different than the above
* in that they usually occupy more virtual memory than physical.
*/
size = MAXBSIZE * nbuf;
buffer_map = kmem_suballoc(kernel_map, (vm_offset_t *)&buffers,
&maxaddr, size, TRUE);
minaddr = (vm_offset_t)buffers;
if (vm_map_find(buffer_map, vm_object_allocate(size), (vm_offset_t)0,
&minaddr, size, FALSE) != KERN_SUCCESS)
panic("cpu_startup: cannot allocate buffers");
base = bufpages / nbuf;
residual = bufpages % nbuf;
for (i = 0; i < nbuf; i++) {
/*
* First <residual> buffers get (base+1) physical pages
* allocated for them. The rest get (base) physical pages.
*
* The rest of each buffer occupies virtual space,
* but has no physical memory allocated for it.
*/
vm_map_pageable(buffer_map, minaddr, minaddr +
CLBYTES * (base + (i < residual)), FALSE);
vm_map_simplify(buffer_map, minaddr);
minaddr += MAXBSIZE;
}
/*
* Allocate a submap for exec arguments. This map effectively
* limits the number of processes exec'ing at any time.
*/
exec_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr,
16*NCARGS, TRUE);
/*
* Allocate a submap for physio
*/
phys_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr,
VM_PHYS_SIZE, TRUE);
/*
* Finally, allocate mbuf pool. Since mclrefcnt is an off-size
* we use the more space efficient malloc in place of kmem_alloc.
*/
mclrefcnt = (char *)malloc(NMBCLUSTERS+CLBYTES/MCLBYTES,
M_MBUF, M_NOWAIT);
bzero(mclrefcnt, NMBCLUSTERS+CLBYTES/MCLBYTES);
mb_map = kmem_suballoc(kernel_map, (vm_offset_t *)&mbutl, &maxaddr,
VM_MBUF_SIZE, FALSE);
/*
* Initialize callouts
*/
callfree = callout;
for (i = 1; i < ncallout; i++)
callout[i-1].c_next = &callout[i];
callout[i-1].c_next = NULL;
#ifdef DEBUG
pmapdebug = opmapdebug;
#endif
printf("avail mem = %ld\n", ptoa(cnt.v_free_count));
printf("using %d buffers containing %d bytes of memory\n",
nbuf, bufpages * CLBYTES);
/*
* Set up buffers, so they can be used to read disk labels.
*/
bufinit();
/*
* Configure the system.
*/
if (boothowto & RB_CONFIG) {
#ifdef BOOT_CONFIG
user_config();
#else
printf("kernel does not support -c; continuing..\n");
#endif
}
hppa_malloc_ok = 1;
configure();
}