本文整理汇总了C++中pwarn函数的典型用法代码示例。如果您正苦于以下问题:C++ pwarn函数的具体用法?C++ pwarn怎么用?C++ pwarn使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pwarn函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: valid_cached_file_version
bool valid_cached_file_version(const char *cachename)
{
char buffer[16];
autofclose FILE *f;
if (!(f = fopen(cachename, "r"))) {
PERROR("Error: Could not read cache file '%s', skipping...\n", cachename);
return false;
}
size_t res = fread(buffer, 1, 16, f);
if (res < 16) {
if (debug_cache)
pwarn("%s: cache file '%s' invalid size\n", progname, cachename);
return false;
}
/* 12 byte header that is always the same and then 4 byte version # */
if (memcmp(buffer, header_string, HEADER_STRING_SIZE) != 0) {
if (debug_cache)
pwarn("%s: cache file '%s' has wrong header\n", progname, cachename);
return false;
}
uint32_t version = cpu_to_le32(ENCODE_VERSION(force_complain,
policy_version,
parser_abi_version,
kernel_abi_version));
if (memcmp(buffer + 12, &version, 4) != 0) {
if (debug_cache)
pwarn("%s: cache file '%s' has wrong version\n", progname, cachename);
return false;
}
return true;
}
开发者ID:crossbuild,项目名称:apparmor,代码行数:34,代码来源:policy_cache.c
示例2: fileerror
void
fileerror(ino_t cwd, ino_t ino, const char *errmesg)
{
char pathbuf[MAXPATHLEN + 1];
struct uvnode *vp;
pwarn("%s ", errmesg);
pinode(ino);
printf("\n");
pwarn("PARENT=%lld\n", (long long)cwd);
getpathname(pathbuf, sizeof(pathbuf), cwd, ino);
if (ino < ULFS_ROOTINO || ino >= maxino) {
pfatal("NAME=%s\n", pathbuf);
return;
}
vp = vget(fs, ino);
if (vp == NULL)
pfatal("INO is NULL\n");
else {
if (ftypeok(VTOD(vp)))
pfatal("%s=%s\n",
(lfs_dino_getmode(fs, VTOI(vp)->i_din) & LFS_IFMT) == LFS_IFDIR ?
"DIR" : "FILE", pathbuf);
else
pfatal("NAME=%s\n", pathbuf);
}
}
开发者ID:ajinkya93,项目名称:netbsd-src,代码行数:27,代码来源:dir.c
示例3: checklost
/*
* Check a complete in-memory FAT for lost cluster chains
*/
int
checklost(int dosfs, struct bootblock *boot, struct fatEntry *fat)
{
cl_t head;
int mod = FSOK;
int ret;
for (head = CLUST_FIRST; head < boot->NumClusters; head++) {
/* find next untravelled chain */
if (fat[head].head != head
|| fat[head].next == CLUST_FREE
|| (fat[head].next >= CLUST_RSRVD
&& fat[head].next < CLUST_EOFS)
|| (fat[head].flags & FAT_USED))
continue;
pwarn("Lost cluster chain at cluster %u\n%d Cluster(s) lost\n",
head, fat[head].length);
mod |= ret = reconnect(dosfs, boot, fat, head);
if (mod & FSFATAL)
break;
if (ret == FSERROR && ask(0, "Clear")) {
clearchain(boot, fat, head);
mod |= FSFATMOD;
}
}
finishlf();
if (boot->FSInfo) {
ret = 0;
if (boot->FSFree != boot->NumFree) {
pwarn("Free space in FSInfo block (%d) not correct (%d)\n",
boot->FSFree, boot->NumFree);
if (ask(1, "fix")) {
boot->FSFree = boot->NumFree;
ret = 1;
}
}
if (boot->NumFree && (boot->FSNext >= boot->NumClusters ||
fat[boot->FSNext].next != CLUST_FREE)) {
pwarn("Next free cluster in FSInfo block (%u) not free\n",
boot->FSNext);
if (ask(1, "fix"))
for (head = CLUST_FIRST; head < boot->NumClusters; head++)
if (fat[head].next == CLUST_FREE) {
boot->FSNext = head;
ret = 1;
break;
}
}
if (ret)
mod |= writefsinfo(dosfs, boot);
}
return mod;
}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:59,代码来源:fat.c
示例4: check_mount_state
/*
* - set mount_point to NULL
* - if name is mounted (search mnttab)
* - if it is a device, clear rflag
* - if mounted on /, /usr, or /var, set corefs
* - if corefs and read-only, set hotroot and continue
* - if errorlocked, continue
* - if preening, bail
* - ask user whether to continue, bail if not
* - if it is a device and not mounted and rflag, convert
* name to raw version
*/
static int
check_mount_state(caddr_t devstr, size_t str_size)
{
int corefs = 0;
int is_dev = 0;
struct stat statb;
if (stat(devstr, &statb) < 0) {
exitstat = EXNOSTAT;
errexit("fsck: could not stat %s: %s", devstr, strerror(errno));
}
if (S_ISCHR(statb.st_mode) || S_ISBLK(statb.st_mode))
is_dev = 1;
/*
* mounted() will update mount_point when returning true.
*/
mount_point = NULL;
if ((mountedfs = mounted(devstr, devstr, str_size)) != M_NOMNT) {
if (is_dev)
rflag = 0;
corefs = which_corefs(mount_point);
if (corefs && (mountedfs == M_RO)) {
hotroot++;
} else if (errorlocked) {
goto carry_on;
} else if (preen) {
exitstat = EXMOUNTED;
pfatal("%s IS CURRENTLY MOUNTED%s.",
devstr, mountedfs == M_RW ? " READ/WRITE" : "");
} else {
if (!nflag) {
pwarn("%s IS CURRENTLY MOUNTED READ/%s.",
devstr, mountedfs == M_RW ? "WRITE" :
"ONLY");
if (reply("CONTINUE") == 0) {
exitstat = EXMOUNTED;
errexit("Program terminated");
}
} else {
pwarn("%s IS CURRENTLY MOUNTED READ/%s.\n",
devstr, mountedfs == M_RW ? "WRITE" :
"ONLY");
}
}
} else if (is_dev && rflag) {
(void) strlcpy(devstr, rawname(devstr), str_size);
}
carry_on:
return (corefs);
}
开发者ID:andreiw,项目名称:polaris,代码行数:64,代码来源:setup.c
示例5: prefix_opts
static int prefix_opts(JFT_Stem *prefix, JFT_Symbol **stop, int argc, char **argv) {
extern char *optarg;
extern int optind, optopt;
int opt, ptr, err = 0, omit = 1;
static struct option options[] = {
{"null", no_argument, NULL, 'n'},
{"stop", no_argument, NULL, 's'},
{"primary", no_argument, NULL, 'p'},
{"indices", no_argument, NULL, 'i'},
{}
};
// default
prefix->pre = JFT_SYMBOL_PRIMARY;
prefix->size = 1;
while ((opt = getopt_long(argc, argv, "hnspi", options, &ptr)) != -1) {
switch(opt) {
case 'h':
return usage(0);
case 'n':
omit = 0;
break;
case 's':
*stop = &null;
break;
case 'p':
prefix->pre = JFT_SYMBOL_PRIMARY;
prefix->size = 1;
break;
case 'i':
prefix->pre = JFT_SYMBOL_INDICES;
prefix->size = 1;
break;
case ':':
pwarn("%s: option requires an argument -- %c", argv[0], optopt);
err++;
break;
case '?':
pwarn("%s: illegal option -- %c", argv[0], optopt);
err++;
break;
}
}
read_prefix(prefix, omit, argc - optind, argv + optind);
return err;
}
开发者ID:jflatow,项目名称:jfdb,代码行数:49,代码来源:jfdb.c
示例6: adjust
void
adjust(struct inodesc *idesc, short lcnt)
{
union dinode *dp;
dp = ginode(idesc->id_number);
if (DIP(dp, di_nlink) == lcnt) {
if (linkup(idesc->id_number, 0) == 0)
clri(idesc, "UNREF", 0);
} else {
pwarn("LINK COUNT %s", (lfdir == idesc->id_number) ? lfname :
((DIP(dp, di_mode) & IFMT) == IFDIR ? "DIR" : "FILE"));
pinode(idesc->id_number);
printf(" COUNT %d SHOULD BE %d", DIP(dp, di_nlink),
DIP(dp, di_nlink) - lcnt);
if (preen || usedsoftdep) {
if (lcnt < 0) {
printf("\n");
pfatal("LINK COUNT INCREASING");
}
if (preen)
printf(" (ADJUSTED)\n");
}
if (preen || reply("ADJUST") == 1) {
DIP_SET(dp, di_nlink, DIP(dp, di_nlink) - lcnt);
inodirty();
}
}
}
开发者ID:repos-holder,项目名称:openbsd-patches,代码行数:29,代码来源:dir.c
示例7: clri
void
clri(struct inodesc *idesc, const char *type, int flag)
{
union dinode *dp;
dp = ginode(idesc->id_number);
if (flag == 1) {
pwarn("%s %s", type,
(DIP(dp, di_mode) & IFMT) == IFDIR ? "DIR" : "FILE");
pinode(idesc->id_number);
}
if (preen || reply("CLEAR") == 1) {
if (preen)
printf(" (CLEARED)\n");
n_files--;
if (bkgrdflag == 0) {
(void)ckinode(dp, idesc);
inoinfo(idesc->id_number)->ino_state = USTATE;
clearinode(dp);
inodirty();
} else {
cmd.value = idesc->id_number;
cmd.size = -DIP(dp, di_nlink);
if (debug)
printf("adjrefcnt ino %ld amt %lld\n",
(long)cmd.value, (long long)cmd.size);
if (sysctl(adjrefcnt, MIBSIZE, 0, 0,
&cmd, sizeof cmd) == -1)
rwerror("ADJUST INODE", cmd.value);
}
}
}
开发者ID:2asoft,项目名称:freebsd,代码行数:32,代码来源:inode.c
示例8: bread
int32_t
bread(int fd, char *buf, daddr_t blk, long size)
{
char *cp;
int i, errs;
offset_t offset = ldbtob(blk);
offset_t addr;
if (llseek(fd, offset, 0) < 0)
rwerror(gettext("SEEK"), blk);
else if (read(fd, buf, (int)size) == size)
return (0);
rwerror(gettext("READ"), blk);
if (llseek(fd, offset, 0) < 0)
rwerror(gettext("SEEK"), blk);
errs = 0;
bzero(buf, (int)size);
pwarn(gettext("THE FOLLOWING SECTORS COULD NOT BE READ:"));
for (cp = buf, i = 0; i < btodb(size); i++, cp += DEV_BSIZE) {
addr = ldbtob(blk + i);
if (llseek(fd, addr, SEEK_CUR) < 0 ||
read(fd, cp, (int)secsize) < 0) {
(void) printf(" %ld", blk + i);
errs++;
}
}
(void) printf("\n");
return (errs);
}
开发者ID:AlainODea,项目名称:illumos-gate,代码行数:29,代码来源:utilities.c
示例9: bwrite
void
bwrite(int fd, char *buf, daddr_t blk, long size)
{
int i, n;
char *cp;
offset_t offset = ldbtob(blk);
offset_t addr;
if (fd < 0)
return;
if (llseek(fd, offset, 0) < 0)
rwerror(gettext("SEEK"), blk);
else if (write(fd, buf, (int)size) == size) {
fsmodified = 1;
return;
}
rwerror(gettext("WRITE"), blk);
if (llseek(fd, offset, 0) < 0)
rwerror(gettext("SEEK"), blk);
pwarn(gettext("THE FOLLOWING SECTORS COULD NOT BE WRITTEN:"));
for (cp = buf, i = 0; i < btodb(size); i++, cp += DEV_BSIZE) {
n = 0;
addr = ldbtob(blk + i);
if (llseek(fd, addr, SEEK_CUR) < 0 ||
(n = write(fd, cp, DEV_BSIZE)) < 0) {
(void) printf(" %ld", blk + i);
} else if (n > 0) {
fsmodified = 1;
}
}
(void) printf("\n");
}
开发者ID:AlainODea,项目名称:illumos-gate,代码行数:33,代码来源:utilities.c
示例10: pdebug
void BeetleInternal::informServicesChanged(handle_range_t range, device_t dst) {
if (debug) {
pdebug("informing " + std::to_string(dst) + " of service change " + range.str());
}
std::lock_guard<std::recursive_mutex> handlesLg(handlesMutex);
if (serviceChangedAttr->subscribersNotify.size() == 0) {
return;
}
uint8_t cmd[7];
cmd[0] = ATT_OP_HANDLE_NOTIFY;
*(uint16_t *) (cmd + 1) = htobs(serviceChangedAttr->getHandle());
*(uint16_t *) (cmd + 3) = htobs(range.start);
*(uint16_t *) (cmd + 5) = htobs(range.end);
if (serviceChangedAttr->subscribersNotify.find(dst) != serviceChangedAttr->subscribersNotify.end()) {
if (beetle.devices.find(dst) != beetle.devices.end()) {
beetle.devices[dst]->writeCommand(cmd, sizeof(cmd));
} else {
pwarn("cannot inform " + std::to_string(dst) + ", does not name a device");
}
} else {
if (debug) {
pdebug(std::to_string(dst) + " is not subscribed to service changed characteristic");
}
}
}
开发者ID:helena-project,项目名称:beetle,代码行数:27,代码来源:BeetleInternal.cpp
示例11: initial_error_state_adjust
static int
initial_error_state_adjust(void)
{
int retval = 0;
/* do this right away to prevent any other fscks on this fs */
switch (sblock.fs_clean) {
case FSBAD:
break;
case FSFIX:
if (preen)
errexit("ERROR-LOCKED; MARKED \"FSFIX\"\n");
if (reply("marked FSFIX, CONTINUE") == 0) {
retval = -1;
goto finish;
}
break;
case FSCLEAN:
if (preen)
errexit("ERROR-LOCKED; MARKED \"FSCLEAN\"\n");
if (reply("marked FSCLEAN, CONTINUE") == 0) {
retval = -1;
goto finish;
}
break;
default:
if (preen) {
if (debug)
pwarn("ERRORLOCKED; NOT MARKED \"FSBAD\"\n");
else
errexit("ERRORLOCKED; NOT MARKED \"FSBAD\"\n");
} else {
(void) printf("error-locked but not marked \"FSBAD\";");
if (reply(" CONTINUE") == 0) {
retval = -1;
goto finish;
}
}
break;
}
if (!do_errorlock(LOCKFS_ELOCK)) {
if (preen) {
retval = -1;
goto finish;
}
if (reply("error-lock reset failed; CONTINUE") == 0) {
retval = -1;
goto finish;
}
}
sblock.fs_state = FSOKAY - (long)sblock.fs_time;
sblock.fs_clean = FSFIX;
sbdirty();
write_altsb(fswritefd);
finish:
return (retval);
}
开发者ID:andreiw,项目名称:polaris,代码行数:60,代码来源:setup.c
示例12: checkclnum
/*
* Check a cluster number for valid value
*/
static int
checkclnum(struct bootblock *boot, int fat, cl_t cl, cl_t *next)
{
if (*next >= (CLUST_RSRVD&boot->ClustMask))
*next |= ~boot->ClustMask;
if (*next == CLUST_FREE) {
boot->NumFree++;
return FSOK;
}
if (*next == CLUST_BAD) {
boot->NumBad++;
return FSOK;
}
if (*next < CLUST_FIRST
|| (*next >= boot->NumClusters && *next < CLUST_EOFS)) {
pwarn("Cluster %u in FAT %d continues with %s cluster number %u\n",
cl, fat,
*next < CLUST_RSRVD ? "out of range" : "reserved",
*next&boot->ClustMask);
if (ask(0, "Truncate")) {
*next = CLUST_EOF;
return FSFATMOD;
}
return FSERROR;
}
return FSOK;
}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:30,代码来源:fat.c
示例13: adjust
void
adjust(struct inodesc *idesc, short lcnt)
{
struct ext2fs_dinode *dp;
dp = ginode(idesc->id_number);
if (fs2h16(dp->e2di_nlink) == lcnt) {
if (linkup(idesc->id_number, (ino_t)0) == 0)
clri(idesc, "UNREF", 0);
} else {
pwarn("LINK COUNT %s", (lfdir == idesc->id_number) ? lfname :
((fs2h16(dp->e2di_mode) & IFMT) == IFDIR ? "DIR" : "FILE"));
pinode(idesc->id_number);
printf(" COUNT %d SHOULD BE %d",
fs2h16(dp->e2di_nlink), fs2h16(dp->e2di_nlink) - lcnt);
if (preen) {
if (lcnt < 0) {
printf("\n");
pfatal("LINK COUNT INCREASING");
}
printf(" (ADJUSTED)\n");
}
if (preen || reply("ADJUST") == 1) {
dp->e2di_nlink = h2fs16(fs2h16(dp->e2di_nlink) - lcnt);
inodirty();
}
}
}
开发者ID:AgamAgarwal,项目名称:minix,代码行数:28,代码来源:dir.c
示例14: pwarn
/*
* Should never get called. All reads and writes are serviced by the cache.
*/
int BeetleInternal::writeTransactionBlocking(uint8_t *buf, int len, uint8_t *&resp) {
if (debug) {
pwarn("Beetle received an unanticipated request");
}
resp = new uint8_t[ATT_ERROR_PDU_LEN];
pack_error_pdu(buf[0], 0, ATT_ECODE_UNLIKELY, resp);
return ATT_ERROR_PDU_LEN;
}
开发者ID:helena-project,项目名称:beetle,代码行数:11,代码来源:BeetleInternal.cpp
示例15: pthreadMayCreate
boolean pthreadMayCreate(pthread_t *thread, const pthread_attr_t *attr,
void *(*start_routine)(void *), void *arg)
/* Create a thread. Warn and return FALSE if there is a problem. */
{
int err = pthread_create(thread, attr, start_routine, arg);
pwarn("pthread_create", err);
return err == 0;
}
开发者ID:blumroy,项目名称:kentUtils,代码行数:8,代码来源:pthreadWrap.c
示例16: dircheck
/*
* Verify that a directory entry is valid.
* This is a superset of the checks made in the kernel.
*/
int
dircheck(struct inodesc *idesc, LFS_DIRHEADER *dp)
{
int size;
const char *cp;
u_char namlen, type;
int spaceleft;
spaceleft = LFS_DIRBLKSIZ - (idesc->id_loc % LFS_DIRBLKSIZ);
if (lfs_dir_getino(fs, dp) >= maxino ||
lfs_dir_getreclen(fs, dp) == 0 ||
lfs_dir_getreclen(fs, dp) > spaceleft ||
(lfs_dir_getreclen(fs, dp) & 0x3) != 0) {
pwarn("ino too large, reclen=0, reclen>space, or reclen&3!=0\n");
pwarn("dp->d_ino = 0x%jx\tdp->d_reclen = 0x%x\n",
(uintmax_t)lfs_dir_getino(fs, dp),
lfs_dir_getreclen(fs, dp));
pwarn("maxino = %ju\tspaceleft = 0x%x\n",
(uintmax_t)maxino, spaceleft);
return (0);
}
if (lfs_dir_getino(fs, dp) == 0)
return (1);
size = LFS_DIRSIZ(fs, dp);
namlen = lfs_dir_getnamlen(fs, dp);
type = lfs_dir_gettype(fs, dp);
if (lfs_dir_getreclen(fs, dp) < size ||
idesc->id_filesize < size ||
/* namlen > MAXNAMLEN || */
type > 15) {
printf("reclen<size, filesize<size, namlen too large, or type>15\n");
return (0);
}
cp = lfs_dir_nameptr(fs, dp);
for (size = 0; size < namlen; size++)
if (*cp == '\0' || (*cp++ == '/')) {
printf("name contains NUL or /\n");
return (0);
}
if (*cp != '\0') {
printf("name size misstated\n");
return (0);
}
return (1);
}
开发者ID:ajinkya93,项目名称:netbsd-src,代码行数:49,代码来源:dir.c
示例17: expanddir
/*
* Attempt to expand the size of a directory
*/
static int
expanddir(struct ext2fs_dinode *dp, char *name)
{
daddr_t lastbn, newblk;
struct bufarea *bp;
char *firstblk;
lastbn = lblkno(&sblock, inosize(dp));
if (lastbn >= NDADDR - 1 || fs2h32(dp->e2di_blocks[lastbn]) == 0 ||
inosize(dp) == 0) {
return (0);
}
if ((newblk = allocblk()) == 0) {
return (0);
}
dp->e2di_blocks[lastbn + 1] = dp->e2di_blocks[lastbn];
dp->e2di_blocks[lastbn] = h2fs32(newblk);
inossize(dp, inosize(dp) + sblock.e2fs_bsize);
dp->e2di_nblock = h2fs32(fs2h32(dp->e2di_nblock) + 1);
bp = getdirblk(fs2h32(dp->e2di_blocks[lastbn + 1]),
sblock.e2fs_bsize);
if (bp->b_errs)
goto bad;
if ((firstblk = malloc(sblock.e2fs_bsize)) == NULL)
err(8, "cannot allocate first block");
memcpy(firstblk, bp->b_un.b_buf, sblock.e2fs_bsize);
bp = getdirblk(newblk, sblock.e2fs_bsize);
if (bp->b_errs) {
free(firstblk);
goto bad;
}
memcpy(bp->b_un.b_buf, firstblk, sblock.e2fs_bsize);
free(firstblk);
dirty(bp);
bp = getdirblk(fs2h32(dp->e2di_blocks[lastbn + 1]),
sblock.e2fs_bsize);
if (bp->b_errs)
goto bad;
emptydir.dot_reclen = h2fs16(sblock.e2fs_bsize);
memcpy(bp->b_un.b_buf, &emptydir, sizeof emptydir);
pwarn("NO SPACE LEFT IN %s", name);
if (preen)
printf(" (EXPANDED)\n");
else if (reply("EXPAND") == 0)
goto bad;
dirty(bp);
inodirty();
return (1);
bad:
dp->e2di_blocks[lastbn] = dp->e2di_blocks[lastbn + 1];
dp->e2di_blocks[lastbn + 1] = 0;
inossize(dp, inosize(dp) - sblock.e2fs_bsize);
dp->e2di_nblock = h2fs32(fs2h32(dp->e2di_nblock) - 1);
freeblk(newblk);
return (0);
}
开发者ID:AgamAgarwal,项目名称:minix,代码行数:59,代码来源:dir.c
示例18: perr
static void perr(char *function, int err)
/* Print out error for function and abort on
* non-zero error code.. */
{
if (err != 0)
{
pwarn(function, err);
noWarnAbort();
}
}
开发者ID:blumroy,项目名称:kentUtils,代码行数:10,代码来源:pthreadWrap.c
示例19: badsb
static void
badsb(int listerr, caddr_t s)
{
if (!listerr)
return;
if (preen)
(void) printf("%s: ", devname);
(void) printf("BAD SUPERBLOCK AT BLOCK %d: %s\n",
bflag != 0 ? bflag : SBLOCK, s);
if (preen) {
pwarn(
"USE AN ALTERNATE SUPERBLOCK TO SUPPLY NEEDED INFORMATION;\n");
pwarn("e.g. fsck [-F ufs] -o b=# [special ...] \n");
exitstat = EXERRFATAL;
pfatal(
"where # is the alternate super block. SEE fsck_ufs(1M). \n");
}
/* we're expected to return if not preening */
}
开发者ID:andreiw,项目名称:polaris,代码行数:19,代码来源:setup.c
示例20: markbusy
void
markbusy(daddr_t block, long count)
{
register int i;
count = roundup(count, secsize) / secsize;
for (i = 0; i < count; i++, block++) {
if ((unsigned)block > part_len) {
pwarn(gettext("Block %lx out of range\n"), block);
break;
}
if (testbusy(block))
pwarn(gettext("Dup block %lx\n"), block);
else {
n_blks++;
setbusy(block);
}
}
}
开发者ID:AlainODea,项目名称:illumos-gate,代码行数:19,代码来源:utilities.c
注:本文中的pwarn函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论