MFH
Sponsored by: The FreeBSD Foundation
This commit is contained in:
commit
e0e3598ce1
@ -34,7 +34,8 @@
|
||||
* Note that some machines eg. rs6000 have a vfork, but not
|
||||
* with the berkeley semantics, so we cannot use it there either.
|
||||
*/
|
||||
#define VFORK
|
||||
/* #define VFORK */
|
||||
#define vfork fork
|
||||
|
||||
/*
|
||||
* BSDJOBS You have BSD-style job control (both process groups and
|
||||
@ -80,7 +81,6 @@
|
||||
/****************** local defines *********************/
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
#define SAVESIGVEC
|
||||
#define NLS_BUGS
|
||||
#define BSD_STYLE_COLORLS
|
||||
/* Use LC_MESSAGES locale category to open the message catalog */
|
||||
|
@ -341,7 +341,7 @@ umaskcmd(int argc __unused, char **argv __unused)
|
||||
} else {
|
||||
void *set;
|
||||
INTOFF;
|
||||
if ((set = setmode (ap)) == 0)
|
||||
if ((set = setmode (ap)) == NULL)
|
||||
error("Illegal number: %s", ap);
|
||||
|
||||
mask = getmode (set, ~mask & 0777);
|
||||
|
@ -628,7 +628,7 @@ simplecmd(union node **rpp, union node *redir)
|
||||
|
||||
/* If we don't have any redirections already, then we must reset */
|
||||
/* rpp to be the address of the local redir variable. */
|
||||
if (redir == 0)
|
||||
if (redir == NULL)
|
||||
rpp = &redir;
|
||||
|
||||
args = NULL;
|
||||
|
@ -3,7 +3,7 @@
|
||||
printf -- '-1-\n'
|
||||
set -- -abc
|
||||
getopts "ab:" OPTION
|
||||
echo ${OPTION}
|
||||
printf '%s\n' "${OPTION}"
|
||||
|
||||
# In this case 'getopts' should realize that we have not provided the
|
||||
# required argument for "-b".
|
||||
@ -14,12 +14,12 @@ echo ${OPTION}
|
||||
printf -- '-2-\n'
|
||||
set -- -ab
|
||||
getopts "ab:" OPTION
|
||||
echo ${OPTION}
|
||||
printf '%s\n' "${OPTION}"
|
||||
getopts "ab:" OPTION 3>&2 2>&1 >&3 3>&-
|
||||
echo ${OPTION}
|
||||
printf '%s\n' "${OPTION}"
|
||||
|
||||
# The 'shift' is aimed at causing an error.
|
||||
printf -- '-3-\n'
|
||||
shift 1
|
||||
getopts "ab:" OPTION
|
||||
echo ${OPTION}
|
||||
printf '%s\n' "${OPTION}"
|
||||
|
@ -3,4 +3,4 @@ set - -ax
|
||||
getopts ax option
|
||||
set -C
|
||||
getopts ax option
|
||||
echo $option
|
||||
printf '%s\n' "$option"
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
args='-ab'
|
||||
getopts ab opt $args
|
||||
echo $?:$opt:$OPTARG
|
||||
printf '%s\n' "$?:$opt:$OPTARG"
|
||||
for dummy in dummy1 dummy2; do
|
||||
getopts ab opt $args
|
||||
echo $?:$opt:$OPTARG
|
||||
printf '%s\n' "$?:$opt:$OPTARG"
|
||||
done
|
||||
|
@ -50,6 +50,9 @@
|
||||
#ifdef illumos
|
||||
#include <libproc.h>
|
||||
#endif
|
||||
#ifdef __FreeBSD__
|
||||
#include <spawn.h>
|
||||
#endif
|
||||
|
||||
typedef struct dtrace_cmd {
|
||||
void (*dc_func)(struct dtrace_cmd *); /* function to compile arg */
|
||||
@ -397,7 +400,41 @@ dof_prune(const char *fname)
|
||||
free(buf);
|
||||
}
|
||||
|
||||
#ifdef illumos
|
||||
#ifdef __FreeBSD__
|
||||
/*
|
||||
* Use nextboot(8) to tell the loader to load DTrace kernel modules during
|
||||
* the next boot of the system. The nextboot(8) configuration is removed during
|
||||
* boot, so it will not persist indefinitely.
|
||||
*/
|
||||
static void
|
||||
bootdof_add(void)
|
||||
{
|
||||
char * const nbargv[] = {
|
||||
"nextboot", "-a",
|
||||
"-e", "dtraceall_load=\"YES\"",
|
||||
"-e", "dtrace_dof_load=\"YES\"",
|
||||
"-e", "dtrace_dof_name=\"/boot/dtrace.dof\"",
|
||||
"-e", "dtrace_dof_type=\"dtrace_dof\"",
|
||||
NULL,
|
||||
};
|
||||
pid_t child;
|
||||
int err, status;
|
||||
|
||||
err = posix_spawnp(&child, "nextboot", NULL, NULL, nbargv,
|
||||
NULL);
|
||||
if (err != 0) {
|
||||
error("failed to execute nextboot: %s", strerror(err));
|
||||
exit(E_ERROR);
|
||||
}
|
||||
|
||||
if (waitpid(child, &status, 0) != child)
|
||||
fatal("waiting for nextboot");
|
||||
if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) {
|
||||
error("nextboot returned with status %d", status);
|
||||
exit(E_ERROR);
|
||||
}
|
||||
}
|
||||
#else
|
||||
static void
|
||||
etcsystem_prune(void)
|
||||
{
|
||||
@ -508,7 +545,7 @@ etcsystem_add(void)
|
||||
|
||||
error("added forceload directives to %s\n", g_ofile);
|
||||
}
|
||||
#endif /* illumos */
|
||||
#endif /* !__FreeBSD__ */
|
||||
|
||||
static void
|
||||
print_probe_info(const dtrace_probeinfo_t *p)
|
||||
@ -643,24 +680,24 @@ anon_prog(const dtrace_cmd_t *dcp, dof_hdr_t *dof, int n)
|
||||
p = (uchar_t *)dof;
|
||||
q = p + dof->dofh_loadsz;
|
||||
|
||||
#ifdef illumos
|
||||
#ifdef __FreeBSD__
|
||||
/*
|
||||
* On FreeBSD, the DOF file is read directly during boot - just write
|
||||
* two hex characters per byte.
|
||||
*/
|
||||
oprintf("dof-data-%d=", n);
|
||||
|
||||
while (p < q)
|
||||
oprintf("%02x", *p++);
|
||||
|
||||
oprintf("\n");
|
||||
#else
|
||||
oprintf("dof-data-%d=0x%x", n, *p++);
|
||||
|
||||
while (p < q)
|
||||
oprintf(",0x%x", *p++);
|
||||
|
||||
oprintf(";\n");
|
||||
#else
|
||||
/*
|
||||
* On FreeBSD, the DOF data is handled as a kernel environment (kenv)
|
||||
* string. We use two hex characters per DOF byte.
|
||||
*/
|
||||
oprintf("dof-data-%d=%02x", n, *p++);
|
||||
|
||||
while (p < q)
|
||||
oprintf("%02x", *p++);
|
||||
|
||||
oprintf("\n");
|
||||
#endif
|
||||
|
||||
dtrace_dof_destroy(g_dtp, dof);
|
||||
@ -1725,8 +1762,7 @@ main(int argc, char *argv[])
|
||||
#else
|
||||
/*
|
||||
* On FreeBSD, anonymous DOF data is written to
|
||||
* the DTrace DOF file that the boot loader will
|
||||
* read if booting with the DTrace option.
|
||||
* the DTrace DOF file.
|
||||
*/
|
||||
g_ofile = "/boot/dtrace.dof";
|
||||
#endif
|
||||
@ -1765,7 +1801,10 @@ main(int argc, char *argv[])
|
||||
* that itself contains a #pragma D option quiet.
|
||||
*/
|
||||
error("saved anonymous enabling in %s\n", g_ofile);
|
||||
#ifdef illumos
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
bootdof_add();
|
||||
#else
|
||||
etcsystem_add();
|
||||
error("run update_drv(1M) or reboot to enable changes\n");
|
||||
#endif
|
||||
|
@ -2156,10 +2156,11 @@ dump_label(const char *dev)
|
||||
uint64_t psize, ashift;
|
||||
int len = strlen(dev) + 1;
|
||||
|
||||
if (strncmp(dev, "/dev/dsk/", 9) == 0) {
|
||||
if (strncmp(dev, ZFS_DISK_ROOTD, strlen(ZFS_DISK_ROOTD)) == 0) {
|
||||
len++;
|
||||
path = malloc(len);
|
||||
(void) snprintf(path, len, "%s%s", "/dev/rdsk/", dev + 9);
|
||||
(void) snprintf(path, len, "%s%s", ZFS_RDISK_ROOTD,
|
||||
dev + strlen(ZFS_DISK_ROOTD));
|
||||
} else {
|
||||
path = strdup(dev);
|
||||
}
|
||||
|
@ -21,12 +21,12 @@
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2011, 2015 by Delphix. All rights reserved.
|
||||
* Copyright (c) 2012 by Frederik Wessels. All rights reserved.
|
||||
* Copyright (c) 2012 Martin Matuska <mm@FreeBSD.org>. All rights reserved.
|
||||
* Copyright (c) 2013 by Prasad Joshi (sTec). All rights reserved.
|
||||
* Copyright 2016 Igor Kozhukhov <ikozhukhov@gmail.com>.
|
||||
* Copyright 2016 Nexenta Systems, Inc.
|
||||
*/
|
||||
|
||||
#include <solaris.h>
|
||||
@ -626,7 +626,10 @@ zpool_do_remove(int argc, char **argv)
|
||||
}
|
||||
|
||||
/*
|
||||
* zpool labelclear <vdev>
|
||||
* zpool labelclear [-f] <vdev>
|
||||
*
|
||||
* -f Force clearing the label for the vdevs which are members of
|
||||
* the exported or foreign pools.
|
||||
*
|
||||
* Verifies that the vdev is not active and zeros out the label information
|
||||
* on the device.
|
||||
@ -634,8 +637,11 @@ zpool_do_remove(int argc, char **argv)
|
||||
int
|
||||
zpool_do_labelclear(int argc, char **argv)
|
||||
{
|
||||
char *vdev, *name;
|
||||
int c, fd = -1, ret = 0;
|
||||
char vdev[MAXPATHLEN];
|
||||
char *name = NULL;
|
||||
struct stat st;
|
||||
int c, fd, ret = 0;
|
||||
nvlist_t *config;
|
||||
pool_state_t state;
|
||||
boolean_t inuse = B_FALSE;
|
||||
boolean_t force = B_FALSE;
|
||||
@ -658,88 +664,110 @@ zpool_do_labelclear(int argc, char **argv)
|
||||
|
||||
/* get vdev name */
|
||||
if (argc < 1) {
|
||||
(void) fprintf(stderr, gettext("missing vdev device name\n"));
|
||||
(void) fprintf(stderr, gettext("missing vdev name\n"));
|
||||
usage(B_FALSE);
|
||||
}
|
||||
if (argc > 1) {
|
||||
(void) fprintf(stderr, gettext("too many arguments\n"));
|
||||
usage(B_FALSE);
|
||||
}
|
||||
|
||||
vdev = argv[0];
|
||||
if ((fd = open(vdev, O_RDWR)) < 0) {
|
||||
(void) fprintf(stderr, gettext("Unable to open %s\n"), vdev);
|
||||
return (B_FALSE);
|
||||
}
|
||||
/*
|
||||
* Check if we were given absolute path and use it as is.
|
||||
* Otherwise if the provided vdev name doesn't point to a file,
|
||||
* try prepending dsk path and appending s0.
|
||||
*/
|
||||
(void) strlcpy(vdev, argv[0], sizeof (vdev));
|
||||
if (vdev[0] != '/' && stat(vdev, &st) != 0) {
|
||||
char *s;
|
||||
|
||||
name = NULL;
|
||||
if (zpool_in_use(g_zfs, fd, &state, &name, &inuse) != 0) {
|
||||
if (force)
|
||||
goto wipe_label;
|
||||
|
||||
(void) fprintf(stderr,
|
||||
gettext("Unable to determine pool state for %s\n"
|
||||
"Use -f to force the clearing any label data\n"), vdev);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (inuse) {
|
||||
switch (state) {
|
||||
default:
|
||||
case POOL_STATE_ACTIVE:
|
||||
case POOL_STATE_SPARE:
|
||||
case POOL_STATE_L2CACHE:
|
||||
(void) fprintf(stderr,
|
||||
gettext("labelclear operation failed.\n"
|
||||
"\tVdev %s is a member (%s), of pool \"%s\".\n"
|
||||
"\tTo remove label information from this device, export or destroy\n"
|
||||
"\tthe pool, or remove %s from the configuration of this pool\n"
|
||||
"\tand retry the labelclear operation\n"),
|
||||
vdev, zpool_pool_state_to_name(state), name, vdev);
|
||||
ret = 1;
|
||||
goto errout;
|
||||
|
||||
case POOL_STATE_EXPORTED:
|
||||
if (force)
|
||||
break;
|
||||
|
||||
(void) fprintf(stderr,
|
||||
gettext("labelclear operation failed.\n"
|
||||
"\tVdev %s is a member of the exported pool \"%s\".\n"
|
||||
"\tUse \"zpool labelclear -f %s\" to force the removal of label\n"
|
||||
"\tinformation.\n"),
|
||||
vdev, name, vdev);
|
||||
ret = 1;
|
||||
goto errout;
|
||||
|
||||
case POOL_STATE_POTENTIALLY_ACTIVE:
|
||||
if (force)
|
||||
break;
|
||||
|
||||
(void) fprintf(stderr,
|
||||
gettext("labelclear operation failed.\n"
|
||||
"\tVdev %s is a member of the pool \"%s\".\n"
|
||||
"\tThis pool is unknown to this system, but may be active on\n"
|
||||
"\tanother system. Use \'zpool labelclear -f %s\' to force the\n"
|
||||
"\tremoval of label information.\n"),
|
||||
vdev, name, vdev);
|
||||
ret = 1;
|
||||
goto errout;
|
||||
|
||||
case POOL_STATE_DESTROYED:
|
||||
/* inuse should never be set for a destoryed pool... */
|
||||
break;
|
||||
(void) snprintf(vdev, sizeof (vdev), "%s/%s",
|
||||
#ifdef illumos
|
||||
ZFS_DISK_ROOT, argv[0]);
|
||||
if ((s = strrchr(argv[0], 's')) == NULL ||
|
||||
!isdigit(*(s + 1)))
|
||||
(void) strlcat(vdev, "s0", sizeof (vdev));
|
||||
#else
|
||||
"/dev", argv[0]);
|
||||
#endif
|
||||
if (stat(vdev, &st) != 0) {
|
||||
(void) fprintf(stderr, gettext(
|
||||
"failed to find device %s, try specifying absolute "
|
||||
"path instead\n"), argv[0]);
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
|
||||
wipe_label:
|
||||
if (zpool_clear_label(fd) != 0) {
|
||||
if ((fd = open(vdev, O_RDWR)) < 0) {
|
||||
(void) fprintf(stderr, gettext("failed to open %s: %s\n"),
|
||||
vdev, strerror(errno));
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (zpool_read_label(fd, &config) != 0 || config == NULL) {
|
||||
(void) fprintf(stderr,
|
||||
gettext("Label clear failed on vdev %s\n"), vdev);
|
||||
gettext("failed to read label from %s\n"), vdev);
|
||||
return (1);
|
||||
}
|
||||
nvlist_free(config);
|
||||
|
||||
ret = zpool_in_use(g_zfs, fd, &state, &name, &inuse);
|
||||
if (ret != 0) {
|
||||
(void) fprintf(stderr,
|
||||
gettext("failed to check state for %s\n"), vdev);
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (!inuse)
|
||||
goto wipe_label;
|
||||
|
||||
switch (state) {
|
||||
default:
|
||||
case POOL_STATE_ACTIVE:
|
||||
case POOL_STATE_SPARE:
|
||||
case POOL_STATE_L2CACHE:
|
||||
(void) fprintf(stderr, gettext(
|
||||
"%s is a member (%s) of pool \"%s\"\n"),
|
||||
vdev, zpool_pool_state_to_name(state), name);
|
||||
ret = 1;
|
||||
goto errout;
|
||||
|
||||
case POOL_STATE_EXPORTED:
|
||||
if (force)
|
||||
break;
|
||||
(void) fprintf(stderr, gettext(
|
||||
"use '-f' to override the following error:\n"
|
||||
"%s is a member of exported pool \"%s\"\n"),
|
||||
vdev, name);
|
||||
ret = 1;
|
||||
goto errout;
|
||||
|
||||
case POOL_STATE_POTENTIALLY_ACTIVE:
|
||||
if (force)
|
||||
break;
|
||||
(void) fprintf(stderr, gettext(
|
||||
"use '-f' to override the following error:\n"
|
||||
"%s is a member of potentially active pool \"%s\"\n"),
|
||||
vdev, name);
|
||||
ret = 1;
|
||||
goto errout;
|
||||
|
||||
case POOL_STATE_DESTROYED:
|
||||
/* inuse should never be set for a destroyed pool */
|
||||
assert(0);
|
||||
break;
|
||||
}
|
||||
|
||||
wipe_label:
|
||||
ret = zpool_clear_label(fd);
|
||||
if (ret != 0) {
|
||||
(void) fprintf(stderr,
|
||||
gettext("failed to clear label for %s\n"), vdev);
|
||||
}
|
||||
|
||||
errout:
|
||||
close(fd);
|
||||
if (name != NULL)
|
||||
free(name);
|
||||
free(name);
|
||||
(void) close(fd);
|
||||
|
||||
return (ret);
|
||||
}
|
||||
|
@ -79,8 +79,6 @@
|
||||
|
||||
#include "zpool_util.h"
|
||||
|
||||
#define DISK_ROOT "/dev/dsk"
|
||||
#define RDISK_ROOT "/dev/rdsk"
|
||||
#define BACKUP_SLICE "s2"
|
||||
|
||||
/*
|
||||
@ -384,7 +382,7 @@ is_whole_disk(const char *arg)
|
||||
char path[MAXPATHLEN];
|
||||
|
||||
(void) snprintf(path, sizeof (path), "%s%s%s",
|
||||
RDISK_ROOT, strrchr(arg, '/'), BACKUP_SLICE);
|
||||
ZFS_RDISK_ROOT, strrchr(arg, '/'), BACKUP_SLICE);
|
||||
if ((fd = open(path, O_RDWR | O_NDELAY)) < 0)
|
||||
return (B_FALSE);
|
||||
if (efi_alloc_and_init(fd, EFI_NUMPAR, &label) != 0) {
|
||||
|
@ -20,10 +20,10 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2015 Nexenta Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013 by Delphix. All rights reserved.
|
||||
* Copyright 2015 RackTop Systems.
|
||||
* Copyright 2016 Nexenta Systems, Inc.
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -1099,9 +1099,7 @@ zpool_open_func(void *arg)
|
||||
}
|
||||
|
||||
/*
|
||||
* Given a file descriptor, clear (zero) the label information. This function
|
||||
* is used in the appliance stack as part of the ZFS sysevent module and
|
||||
* to implement the "zpool labelclear" command.
|
||||
* Given a file descriptor, clear (zero) the label information.
|
||||
*/
|
||||
int
|
||||
zpool_clear_label(int fd)
|
||||
@ -1168,7 +1166,7 @@ zpool_find_import_impl(libzfs_handle_t *hdl, importargs_t *iarg)
|
||||
*/
|
||||
for (i = 0; i < dirs; i++) {
|
||||
tpool_t *t;
|
||||
char *rdsk;
|
||||
char rdsk[MAXPATHLEN];
|
||||
int dfd;
|
||||
boolean_t config_failed = B_FALSE;
|
||||
DIR *dirp;
|
||||
@ -1184,15 +1182,17 @@ zpool_find_import_impl(libzfs_handle_t *hdl, importargs_t *iarg)
|
||||
*end = 0;
|
||||
pathleft = &path[sizeof (path)] - end;
|
||||
|
||||
#ifdef illumos
|
||||
/*
|
||||
* Using raw devices instead of block devices when we're
|
||||
* reading the labels skips a bunch of slow operations during
|
||||
* close(2) processing, so we replace /dev/dsk with /dev/rdsk.
|
||||
*/
|
||||
if (strcmp(path, "/dev/dsk/") == 0)
|
||||
rdsk = "/dev/";
|
||||
if (strcmp(path, ZFS_DISK_ROOTD) == 0)
|
||||
(void) strlcpy(rdsk, ZFS_RDISK_ROOTD, sizeof (rdsk));
|
||||
else
|
||||
rdsk = path;
|
||||
#endif
|
||||
(void) strlcpy(rdsk, path, sizeof (rdsk));
|
||||
|
||||
if ((dfd = open64(rdsk, O_RDONLY)) < 0 ||
|
||||
(dirp = fdopendir(dfd)) == NULL) {
|
||||
|
@ -20,10 +20,10 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2015 Nexenta Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2015 by Delphix. All rights reserved.
|
||||
* Copyright (c) 2013, Joyent, Inc. All rights reserved.
|
||||
* Copyright 2016 Nexenta Systems, Inc.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -49,8 +49,6 @@
|
||||
|
||||
static int read_efi_label(nvlist_t *config, diskaddr_t *sb);
|
||||
|
||||
#define DISK_ROOT "/dev/dsk"
|
||||
#define RDISK_ROOT "/dev/rdsk"
|
||||
#define BACKUP_SLICE "s2"
|
||||
|
||||
typedef struct prop_flags {
|
||||
@ -2345,7 +2343,7 @@ zpool_relabel_disk(libzfs_handle_t *hdl, const char *name)
|
||||
"efi_use_whole_disk")) == NULL)
|
||||
return (-1);
|
||||
|
||||
(void) snprintf(path, sizeof (path), "%s/%s", RDISK_ROOT, name);
|
||||
(void) snprintf(path, sizeof (path), "%s/%s", ZFS_RDISK_ROOT, name);
|
||||
|
||||
if ((fd = open(path, O_RDWR | O_NDELAY)) < 0) {
|
||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "cannot "
|
||||
@ -2421,7 +2419,7 @@ zpool_vdev_online(zpool_handle_t *zhp, const char *path, int flags,
|
||||
}
|
||||
|
||||
if (wholedisk) {
|
||||
pathname += strlen(DISK_ROOT) + 1;
|
||||
pathname += strlen(ZFS_DISK_ROOT) + 1;
|
||||
(void) zpool_relabel_disk(hdl, pathname);
|
||||
}
|
||||
}
|
||||
@ -3411,8 +3409,8 @@ zpool_vdev_name(libzfs_handle_t *hdl, zpool_handle_t *zhp, nvlist_t *nv,
|
||||
}
|
||||
|
||||
#ifdef illumos
|
||||
if (strncmp(path, "/dev/dsk/", 9) == 0)
|
||||
path += 9;
|
||||
if (strncmp(path, ZFS_DISK_ROOTD, strlen(ZFS_DISK_ROOTD)) == 0)
|
||||
path += strlen(ZFS_DISK_ROOTD);
|
||||
|
||||
if (nvlist_lookup_uint64(nv, ZPOOL_CONFIG_WHOLE_DISK,
|
||||
&value) == 0 && value) {
|
||||
@ -3846,7 +3844,7 @@ read_efi_label(nvlist_t *config, diskaddr_t *sb)
|
||||
if (nvlist_lookup_string(config, ZPOOL_CONFIG_PATH, &path) != 0)
|
||||
return (err);
|
||||
|
||||
(void) snprintf(diskname, sizeof (diskname), "%s%s", RDISK_ROOT,
|
||||
(void) snprintf(diskname, sizeof (diskname), "%s%s", ZFS_RDISK_ROOT,
|
||||
strrchr(path, '/'));
|
||||
if ((fd = open(diskname, O_RDONLY|O_NDELAY)) >= 0) {
|
||||
struct dk_gpt *vtoc;
|
||||
@ -3931,7 +3929,7 @@ zpool_label_disk(libzfs_handle_t *hdl, zpool_handle_t *zhp, const char *name)
|
||||
start_block = NEW_START_BLOCK;
|
||||
}
|
||||
|
||||
(void) snprintf(path, sizeof (path), "%s/%s%s", RDISK_ROOT, name,
|
||||
(void) snprintf(path, sizeof (path), "%s/%s%s", ZFS_RDISK_ROOT, name,
|
||||
BACKUP_SLICE);
|
||||
|
||||
if ((fd = open(path, O_RDWR | O_NDELAY)) < 0) {
|
||||
|
@ -46,9 +46,11 @@ ATF_TC_HEAD(gettimeofday_err, tc)
|
||||
ATF_TC_BODY(gettimeofday_err, tc)
|
||||
{
|
||||
|
||||
#ifdef __NetBSD__
|
||||
errno = 0;
|
||||
|
||||
ATF_REQUIRE_ERRNO(EFAULT, gettimeofday((void *)-1, NULL) != 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
ATF_TC(gettimeofday_mono);
|
||||
|
@ -1,5 +1,7 @@
|
||||
# $FreeBSD$
|
||||
|
||||
CFLAGS+= -DNO_COMPAT7
|
||||
|
||||
SRCS+= _ctx_start.S \
|
||||
fabs.S \
|
||||
flt_rounds.c \
|
||||
|
@ -1,5 +1,7 @@
|
||||
# $FreeBSD$
|
||||
|
||||
MIASM:= ${MIASM:Nfreebsd[467]_*}
|
||||
|
||||
SRCS+= __vdso_gettc.c
|
||||
|
||||
#MDASM= ptrace.S
|
||||
|
@ -423,7 +423,8 @@ hdestroy(HTAB *hashp)
|
||||
free(hashp->tmp_buf);
|
||||
|
||||
if (hashp->fp != -1) {
|
||||
(void)_fsync(hashp->fp);
|
||||
if (hashp->save_file)
|
||||
(void)_fsync(hashp->fp);
|
||||
(void)_close(hashp->fp);
|
||||
}
|
||||
|
||||
@ -770,7 +771,7 @@ hash_seq(const DB *dbp, DBT *key, DBT *data, u_int32_t flag)
|
||||
if (__big_keydata(hashp, bufp, key, data, 1))
|
||||
return (ERROR);
|
||||
} else {
|
||||
if (hashp->cpage == 0)
|
||||
if (hashp->cpage == NULL)
|
||||
return (ERROR);
|
||||
key->data = (u_char *)hashp->cpage->page + bp[ndx];
|
||||
key->size = (ndx > 1 ? bp[ndx - 1] : hashp->BSIZE) - bp[ndx];
|
||||
|
@ -245,7 +245,7 @@ newbuf(HTAB *hashp, u_int32_t addr, BUFHEAD *prev_bp)
|
||||
*/
|
||||
for (xbp = bp; xbp->ovfl;) {
|
||||
next_xbp = xbp->ovfl;
|
||||
xbp->ovfl = 0;
|
||||
xbp->ovfl = NULL;
|
||||
xbp = next_xbp;
|
||||
|
||||
/* Check that ovfl pointer is up date. */
|
||||
@ -350,7 +350,7 @@ __buf_free(HTAB *hashp, int do_free, int to_disk)
|
||||
void
|
||||
__reclaim_buf(HTAB *hashp, BUFHEAD *bp)
|
||||
{
|
||||
bp->ovfl = 0;
|
||||
bp->ovfl = NULL;
|
||||
bp->addr = 0;
|
||||
bp->flags = 0;
|
||||
BUF_REMOVE(bp);
|
||||
|
@ -96,7 +96,7 @@ errc(int eval, int code, const char *fmt, ...)
|
||||
void
|
||||
verrc(int eval, int code, const char *fmt, va_list ap)
|
||||
{
|
||||
if (err_file == 0)
|
||||
if (err_file == NULL)
|
||||
err_set_file((FILE *)0);
|
||||
fprintf(err_file, "%s: ", _getprogname());
|
||||
if (fmt != NULL) {
|
||||
@ -121,7 +121,7 @@ errx(int eval, const char *fmt, ...)
|
||||
void
|
||||
verrx(int eval, const char *fmt, va_list ap)
|
||||
{
|
||||
if (err_file == 0)
|
||||
if (err_file == NULL)
|
||||
err_set_file((FILE *)0);
|
||||
fprintf(err_file, "%s: ", _getprogname());
|
||||
if (fmt != NULL)
|
||||
@ -161,7 +161,7 @@ warnc(int code, const char *fmt, ...)
|
||||
void
|
||||
vwarnc(int code, const char *fmt, va_list ap)
|
||||
{
|
||||
if (err_file == 0)
|
||||
if (err_file == NULL)
|
||||
err_set_file((FILE *)0);
|
||||
fprintf(err_file, "%s: ", _getprogname());
|
||||
if (fmt != NULL) {
|
||||
@ -183,7 +183,7 @@ warnx(const char *fmt, ...)
|
||||
void
|
||||
vwarnx(const char *fmt, va_list ap)
|
||||
{
|
||||
if (err_file == 0)
|
||||
if (err_file == NULL)
|
||||
err_set_file((FILE *)0);
|
||||
fprintf(err_file, "%s: ", _getprogname());
|
||||
if (fmt != NULL)
|
||||
|
@ -56,7 +56,7 @@ getmntinfo(struct statfs **mntbufp, int flags)
|
||||
if (mntbuf)
|
||||
free(mntbuf);
|
||||
bufsize = (mntsize + 1) * sizeof(struct statfs);
|
||||
if ((mntbuf = (struct statfs *)malloc(bufsize)) == 0)
|
||||
if ((mntbuf = malloc(bufsize)) == NULL)
|
||||
return (0);
|
||||
if ((mntsize = getfsstat(mntbuf, bufsize, flags)) < 0)
|
||||
return (0);
|
||||
|
@ -209,7 +209,7 @@ _filldir(DIR *dirp, bool use_current_pos)
|
||||
* On the second pass, save pointers to each one.
|
||||
* Then sort the pointers and remove duplicate names.
|
||||
*/
|
||||
for (dpv = 0;;) {
|
||||
for (dpv = NULL;;) {
|
||||
n = 0;
|
||||
ddptr = buf;
|
||||
while (ddptr < ddeptr) {
|
||||
|
@ -29,7 +29,9 @@
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#ifndef NO_COMPAT7
|
||||
#define _WANT_SEMUN_OLD
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/ipc.h>
|
||||
@ -38,8 +40,10 @@ __FBSDID("$FreeBSD$");
|
||||
#include <stdlib.h>
|
||||
|
||||
int __semctl(int semid, int semnum, int cmd, union semun *arg);
|
||||
#ifndef NO_COMPAT7
|
||||
int freebsd7___semctl(int semid, int semnum, int cmd, union semun_old *arg);
|
||||
int freebsd7_semctl(int semid, int semnum, int cmd, ...);
|
||||
#endif
|
||||
|
||||
int
|
||||
semctl(int semid, int semnum, int cmd, ...)
|
||||
@ -61,6 +65,7 @@ semctl(int semid, int semnum, int cmd, ...)
|
||||
return (__semctl(semid, semnum, cmd, semun_ptr));
|
||||
}
|
||||
|
||||
#ifndef NO_COMPAT7
|
||||
int
|
||||
freebsd7_semctl(int semid, int semnum, int cmd, ...)
|
||||
{
|
||||
@ -82,3 +87,4 @@ freebsd7_semctl(int semid, int semnum, int cmd, ...)
|
||||
}
|
||||
|
||||
__sym_compat(semctl, freebsd7_semctl, FBSD_1.0);
|
||||
#endif
|
||||
|
@ -285,7 +285,7 @@ _init_tls(void)
|
||||
while (*sp++ != 0)
|
||||
;
|
||||
aux = (Elf_Auxinfo *) sp;
|
||||
phdr = 0;
|
||||
phdr = NULL;
|
||||
phent = phnum = 0;
|
||||
for (auxp = aux; auxp->a_type != AT_NULL; auxp++) {
|
||||
switch (auxp->a_type) {
|
||||
@ -302,7 +302,7 @@ _init_tls(void)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (phdr == 0 || phent != sizeof(Elf_Phdr) || phnum == 0)
|
||||
if (phdr == NULL || phent != sizeof(Elf_Phdr) || phnum == 0)
|
||||
return;
|
||||
|
||||
for (i = 0; (unsigned) i < phnum; i++) {
|
||||
|
@ -38,9 +38,11 @@
|
||||
#define __sym_compat(sym,impl,verid) \
|
||||
.symver impl, sym@verid
|
||||
|
||||
#ifndef NO_COMPAT7
|
||||
__sym_compat(__semctl, freebsd7___semctl, FBSD_1.0);
|
||||
__sym_compat(msgctl, freebsd7_msgctl, FBSD_1.0);
|
||||
__sym_compat(shmctl, freebsd7_shmctl, FBSD_1.0);
|
||||
#endif
|
||||
|
||||
#undef __sym_compat
|
||||
|
||||
|
@ -155,12 +155,11 @@ __attribute__((unused)) static void
|
||||
xlocale_release(void *val)
|
||||
{
|
||||
struct xlocale_refcounted *obj = val;
|
||||
long count = atomic_fetchadd_long(&(obj->retain_count), -1) - 1;
|
||||
if (count < 0) {
|
||||
if (0 != obj->destructor) {
|
||||
obj->destructor(obj);
|
||||
}
|
||||
}
|
||||
long count;
|
||||
|
||||
count = atomic_fetchadd_long(&(obj->retain_count), -1) - 1;
|
||||
if (count < 0 && obj->destructor != NULL)
|
||||
obj->destructor(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -210,7 +210,7 @@ b64_pton(const char *src, u_char *target, size_t targsize)
|
||||
break;
|
||||
|
||||
pos = strchr(Base64, ch);
|
||||
if (pos == 0) /* A non-base64 character. */
|
||||
if (pos == NULL) /* A non-base64 character. */
|
||||
return (-1);
|
||||
|
||||
switch (state) {
|
||||
|
@ -85,7 +85,7 @@ getifaddrs(struct ifaddrs **pif)
|
||||
size_t needed;
|
||||
char *buf;
|
||||
char *next;
|
||||
struct ifaddrs *cif = 0;
|
||||
struct ifaddrs *cif;
|
||||
char *p, *p0;
|
||||
struct rt_msghdr *rtm;
|
||||
struct if_msghdrl *ifm;
|
||||
@ -214,6 +214,7 @@ getifaddrs(struct ifaddrs **pif)
|
||||
ift = ifa;
|
||||
|
||||
idx = 0;
|
||||
cif = NULL;
|
||||
for (next = buf; next < buf + needed; next += rtm->rtm_msglen) {
|
||||
rtm = (struct rt_msghdr *)(void *)next;
|
||||
if (rtm->rtm_version != RTM_VERSION)
|
||||
|
@ -406,14 +406,14 @@ files_servent(void *retval, void *mdata, va_list ap)
|
||||
|
||||
continue;
|
||||
gotname:
|
||||
if (proto == 0 || strcmp(serv->s_proto, proto) == 0)
|
||||
if (proto == NULL || strcmp(serv->s_proto, proto) == 0)
|
||||
rv = NS_SUCCESS;
|
||||
break;
|
||||
case nss_lt_id:
|
||||
if (port != serv->s_port)
|
||||
continue;
|
||||
|
||||
if (proto == 0 || strcmp(serv->s_proto, proto) == 0)
|
||||
if (proto == NULL || strcmp(serv->s_proto, proto) == 0)
|
||||
rv = NS_SUCCESS;
|
||||
break;
|
||||
case nss_lt_all:
|
||||
|
@ -207,7 +207,7 @@ rcmd_af(char **ahost, int rport, const char *locuser, const char *remuser,
|
||||
}
|
||||
}
|
||||
lport--;
|
||||
if (fd2p == 0) {
|
||||
if (fd2p == NULL) {
|
||||
_write(s, "", 1);
|
||||
lport = 0;
|
||||
} else {
|
||||
|
@ -81,7 +81,7 @@ static const char *
|
||||
format_flag(uint32_t *var, const struct flagnames_struct *flags)
|
||||
{
|
||||
|
||||
for (; flags->name != 0; flags++) {
|
||||
for (; flags->name != NULL; flags++) {
|
||||
if ((flags->flag & *var) == 0)
|
||||
continue;
|
||||
|
||||
|
@ -75,7 +75,7 @@ __res_init_ctx(void) {
|
||||
return (0);
|
||||
}
|
||||
|
||||
if ((mt = malloc(sizeof (mtctxres_t))) == 0) {
|
||||
if ((mt = malloc(sizeof(mtctxres_t))) == NULL) {
|
||||
errno = ENOMEM;
|
||||
return (-1);
|
||||
}
|
||||
@ -94,10 +94,7 @@ __res_init_ctx(void) {
|
||||
static void
|
||||
__res_destroy_ctx(void *value) {
|
||||
|
||||
mtctxres_t *mt = (mtctxres_t *)value;
|
||||
|
||||
if (mt != 0)
|
||||
free(mt);
|
||||
free(value);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -130,9 +127,9 @@ ___mtctxres(void) {
|
||||
* that fails return a global context.
|
||||
*/
|
||||
if (mt_key_initialized) {
|
||||
if (((mt = pthread_getspecific(key)) != 0) ||
|
||||
if (((mt = pthread_getspecific(key)) != NULL) ||
|
||||
(__res_init_ctx() == 0 &&
|
||||
(mt = pthread_getspecific(key)) != 0)) {
|
||||
(mt = pthread_getspecific(key)) != NULL)) {
|
||||
return (mt);
|
||||
}
|
||||
}
|
||||
|
@ -315,7 +315,7 @@ __res_vinit(res_state statp, int preinit) {
|
||||
while (*cp != '\0' && *cp != ' ' && *cp != '\t' && *cp != '\n')
|
||||
cp++;
|
||||
*cp = '\0';
|
||||
*pp++ = 0;
|
||||
*pp++ = NULL;
|
||||
}
|
||||
|
||||
#define MATCH(line, name) \
|
||||
@ -391,7 +391,7 @@ __res_vinit(res_state statp, int preinit) {
|
||||
while (*cp != '\0' && *cp != ' ' && *cp != '\t')
|
||||
cp++;
|
||||
*cp = '\0';
|
||||
*pp++ = 0;
|
||||
*pp++ = NULL;
|
||||
havesearch = 1;
|
||||
continue;
|
||||
}
|
||||
|
@ -1175,7 +1175,7 @@ res_protocolname(int num) {
|
||||
if (protolist == (struct valuelist *)0)
|
||||
res_buildprotolist();
|
||||
pp = cgetprotobynumber(num);
|
||||
if (pp == 0) {
|
||||
if (pp == NULL) {
|
||||
(void) sprintf(number, "%d", num);
|
||||
return (number);
|
||||
}
|
||||
@ -1190,7 +1190,7 @@ res_servicename(u_int16_t port, const char *proto) { /*%< Host byte order. */
|
||||
if (servicelist == (struct valuelist *)0)
|
||||
res_buildservicelist();
|
||||
ss = cgetservbyport(htons(port), proto);
|
||||
if (ss == 0) {
|
||||
if (ss == NULL) {
|
||||
(void) sprintf(number, "%d", port);
|
||||
return (number);
|
||||
}
|
||||
|
@ -83,9 +83,9 @@ authnone_create(void)
|
||||
XDR *xdrs;
|
||||
|
||||
mutex_lock(&authnone_lock);
|
||||
if (ap == 0) {
|
||||
ap = (struct authnone_private *)calloc(1, sizeof (*ap));
|
||||
if (ap == 0) {
|
||||
if (ap == NULL) {
|
||||
ap = calloc(1, sizeof (*ap));
|
||||
if (ap == NULL) {
|
||||
mutex_unlock(&authnone_lock);
|
||||
return (0);
|
||||
}
|
||||
|
@ -64,8 +64,8 @@ static char *
|
||||
_buf(void)
|
||||
{
|
||||
|
||||
if (buf == 0)
|
||||
buf = (char *)malloc(CLNT_PERROR_BUFLEN);
|
||||
if (buf == NULL)
|
||||
buf = malloc(CLNT_PERROR_BUFLEN);
|
||||
return (buf);
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ clnt_sperror(CLIENT *rpch, const char *s)
|
||||
assert(s != NULL);
|
||||
|
||||
str = _buf(); /* side effect: sets CLNT_PERROR_BUFLEN */
|
||||
if (str == 0)
|
||||
if (str == NULL)
|
||||
return (0);
|
||||
len = CLNT_PERROR_BUFLEN;
|
||||
strstart = str;
|
||||
@ -240,7 +240,7 @@ clnt_spcreateerror(const char *s)
|
||||
assert(s != NULL);
|
||||
|
||||
str = _buf(); /* side effect: sets CLNT_PERROR_BUFLEN */
|
||||
if (str == 0)
|
||||
if (str == NULL)
|
||||
return(0);
|
||||
len = CLNT_PERROR_BUFLEN;
|
||||
i = snprintf(str, len, "%s: ", s);
|
||||
|
@ -95,7 +95,7 @@ rce_key_init(void)
|
||||
struct rpc_createerr *
|
||||
__rpc_createerr(void)
|
||||
{
|
||||
struct rpc_createerr *rce_addr = 0;
|
||||
struct rpc_createerr *rce_addr = NULL;
|
||||
|
||||
if (thr_main())
|
||||
return (&rpc_createerr);
|
||||
|
@ -43,20 +43,20 @@ __FBSDID("$FreeBSD$");
|
||||
#include <string.h>
|
||||
#include "un-namespace.h"
|
||||
|
||||
static char *default_domain = 0;
|
||||
static char *default_domain;
|
||||
|
||||
static char *
|
||||
get_default_domain(void)
|
||||
{
|
||||
char temp[256];
|
||||
|
||||
if (default_domain)
|
||||
if (default_domain != NULL)
|
||||
return (default_domain);
|
||||
if (getdomainname(temp, sizeof(temp)) < 0)
|
||||
return (0);
|
||||
if ((int) strlen(temp) > 0) {
|
||||
default_domain = (char *)malloc((strlen(temp)+(unsigned)1));
|
||||
if (default_domain == 0)
|
||||
default_domain = malloc((strlen(temp) + (unsigned)1));
|
||||
if (default_domain == NULL)
|
||||
return (0);
|
||||
(void) strcpy(default_domain, temp);
|
||||
return (default_domain);
|
||||
@ -73,7 +73,7 @@ get_default_domain(void)
|
||||
int
|
||||
__rpc_get_default_domain(char **domain)
|
||||
{
|
||||
if ((*domain = get_default_domain()) != 0)
|
||||
if ((*domain = get_default_domain()) != NULL)
|
||||
return (0);
|
||||
return (-1);
|
||||
}
|
||||
|
@ -2068,14 +2068,14 @@ static void
|
||||
roundingPrecisionName = "80";
|
||||
}
|
||||
else {
|
||||
roundingPrecisionName = 0;
|
||||
roundingPrecisionName = NULL;
|
||||
}
|
||||
#ifdef FLOATX80
|
||||
floatx80_rounding_precision = roundingPrecision;
|
||||
#endif
|
||||
switch ( roundingMode ) {
|
||||
case 0:
|
||||
roundingModeName = 0;
|
||||
roundingModeName = NULL;
|
||||
roundingCode = float_round_nearest_even;
|
||||
break;
|
||||
case ROUND_NEAREST_EVEN:
|
||||
@ -2098,7 +2098,7 @@ static void
|
||||
float_rounding_mode = roundingCode;
|
||||
switch ( tininessMode ) {
|
||||
case 0:
|
||||
tininessModeName = 0;
|
||||
tininessModeName = NULL;
|
||||
tininessCode = float_tininess_after_rounding;
|
||||
break;
|
||||
case TININESS_BEFORE_ROUNDING:
|
||||
|
@ -49,7 +49,7 @@ uuid_to_string(const uuid_t *u, char **s, uint32_t *status)
|
||||
*status = uuid_s_ok;
|
||||
|
||||
/* Why allow a NULL-pointer here? */
|
||||
if (s == 0)
|
||||
if (s == NULL)
|
||||
return;
|
||||
|
||||
if (u == NULL) {
|
||||
|
@ -215,7 +215,7 @@ xdrmem_setpos(XDR *xdrs, u_int pos)
|
||||
static int32_t *
|
||||
xdrmem_inline_aligned(XDR *xdrs, u_int len)
|
||||
{
|
||||
int32_t *buf = 0;
|
||||
int32_t *buf = NULL;
|
||||
|
||||
if (xdrs->x_handy >= len) {
|
||||
xdrs->x_handy -= len;
|
||||
|
@ -471,7 +471,7 @@ fn_complete(EditLine *el,
|
||||
|
||||
/* these can be used by function called in completion_matches() */
|
||||
/* or (*attempted_completion_function)() */
|
||||
if (point != 0)
|
||||
if (point != NULL)
|
||||
*point = (int)(li->cursor - li->buffer);
|
||||
if (end != NULL)
|
||||
*end = (int)(li->lastchar - li->buffer);
|
||||
@ -483,7 +483,7 @@ fn_complete(EditLine *el,
|
||||
&el->el_scratch),
|
||||
cur_off - (int)len, cur_off);
|
||||
} else
|
||||
matches = 0;
|
||||
matches = NULL;
|
||||
if (!attempted_completion_function ||
|
||||
(over != NULL && !*over && !matches))
|
||||
matches = completion_matches(
|
||||
|
@ -1088,7 +1088,7 @@ vi_history_word(EditLine *el, Int c __attribute__((__unused__)))
|
||||
if (wp == NULL)
|
||||
return CC_ERROR;
|
||||
|
||||
wep = wsp = 0;
|
||||
wep = wsp = NULL;
|
||||
do {
|
||||
while (Isspace(*wp))
|
||||
wp++;
|
||||
@ -1101,7 +1101,7 @@ vi_history_word(EditLine *el, Int c __attribute__((__unused__)))
|
||||
} while ((!el->el_state.doingarg || --el->el_state.argument > 0)
|
||||
&& *wp != 0);
|
||||
|
||||
if (wsp == 0 || (el->el_state.doingarg && el->el_state.argument != 0))
|
||||
if (wsp == NULL || (el->el_state.doingarg && el->el_state.argument != 0))
|
||||
return CC_ERROR;
|
||||
|
||||
cv_undo(el);
|
||||
|
@ -929,7 +929,7 @@ ftp_authenticate(conn_t *conn, struct url *url, struct url *purl)
|
||||
if (*pwd == '\0')
|
||||
pwd = getenv("FTP_PASSWORD");
|
||||
if (pwd == NULL || *pwd == '\0') {
|
||||
if ((logname = getlogin()) == 0)
|
||||
if ((logname = getlogin()) == NULL)
|
||||
logname = FTP_ANONYMOUS_USER;
|
||||
if ((len = snprintf(pbuf, MAXLOGNAME + 1, "%s@", logname)) < 0)
|
||||
len = 0;
|
||||
|
@ -860,7 +860,7 @@ verify_krb_v5_tgt(krb5_context context, krb5_ccache ccache,
|
||||
services[0] = "host";
|
||||
services[1] = pam_service;
|
||||
services[2] = NULL;
|
||||
keyblock = 0;
|
||||
keyblock = NULL;
|
||||
retval = -1;
|
||||
for (service = &services[0]; *service != NULL; service++) {
|
||||
retval = krb5_sname_to_principal(context, NULL, *service,
|
||||
|
@ -124,7 +124,7 @@ list_match(char *list, const char *item,
|
||||
* the match is affected by any exceptions.
|
||||
*/
|
||||
|
||||
for (tok = strtok(list, sep); tok != 0; tok = strtok((char *) 0, sep)) {
|
||||
for (tok = strtok(list, sep); tok != NULL; tok = strtok((char *) 0, sep)) {
|
||||
if (strcasecmp(tok, "EXCEPT") == 0) /* EXCEPT: give up */
|
||||
break;
|
||||
if ((match = (*match_fn)(tok, item)) != 0) /* YES */
|
||||
@ -135,7 +135,7 @@ list_match(char *list, const char *item,
|
||||
if (match != NO) {
|
||||
while ((tok = strtok((char *) 0, sep)) && strcasecmp(tok, "EXCEPT"))
|
||||
/* VOID */ ;
|
||||
if (tok == 0 || list_match((char *) 0, item, match_fn) == NO)
|
||||
if (tok == NULL || list_match((char *) 0, item, match_fn) == NO)
|
||||
return (match);
|
||||
}
|
||||
return (NO);
|
||||
|
@ -22,11 +22,11 @@
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "namespace.h"
|
||||
#include <pthread_np.h>
|
||||
#include <sys/param.h>
|
||||
|
@ -89,10 +89,11 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
|
@ -29,10 +29,11 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#include "thr_private.h"
|
||||
|
@ -22,10 +22,11 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
@ -34,6 +35,9 @@
|
||||
|
||||
#include "thr_private.h"
|
||||
|
||||
_Static_assert(sizeof(struct pthread_barrier) <= PAGE_SIZE,
|
||||
"pthread_barrier is too large for off-page");
|
||||
|
||||
__weak_reference(_pthread_barrier_init, pthread_barrier_init);
|
||||
__weak_reference(_pthread_barrier_wait, pthread_barrier_wait);
|
||||
__weak_reference(_pthread_barrier_destroy, pthread_barrier_destroy);
|
||||
|
@ -24,10 +24,11 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
||||
* DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -22,11 +22,11 @@
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "namespace.h"
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
|
@ -25,10 +25,11 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "namespace.h"
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
|
@ -28,10 +28,11 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
|
@ -26,10 +26,11 @@
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "namespace.h"
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
@ -40,6 +41,9 @@
|
||||
|
||||
#include "thr_private.h"
|
||||
|
||||
_Static_assert(sizeof(struct pthread_cond) <= PAGE_SIZE,
|
||||
"pthread_cond too large");
|
||||
|
||||
/*
|
||||
* Prototypes
|
||||
*/
|
||||
|
@ -25,10 +25,11 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "namespace.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -23,10 +23,11 @@
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "namespace.h"
|
||||
#include <sys/types.h>
|
||||
#include <sys/rtprio.h>
|
||||
|
@ -23,11 +23,11 @@
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "namespace.h"
|
||||
#include <sys/types.h>
|
||||
#include <errno.h>
|
||||
|
@ -25,9 +25,11 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "namespace.h"
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
|
@ -22,10 +22,11 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "thr_private.h"
|
||||
|
||||
void
|
||||
|
@ -25,10 +25,11 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#ifdef _PTHREAD_FORCED_UNWIND
|
||||
|
@ -23,8 +23,6 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -57,6 +55,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/syscall.h>
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
|
@ -22,10 +22,11 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
|
@ -25,9 +25,11 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
|
@ -28,10 +28,11 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "namespace.h"
|
||||
#include <sys/types.h>
|
||||
#include <sys/rtprio.h>
|
||||
|
@ -21,10 +21,11 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "namespace.h"
|
||||
#include <pthread.h>
|
||||
#include <pthread_np.h>
|
||||
|
@ -25,10 +25,11 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "namespace.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -29,10 +29,11 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "namespace.h"
|
||||
#include <sys/types.h>
|
||||
#include <sys/signalvar.h>
|
||||
|
@ -22,11 +22,11 @@
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
|
@ -23,10 +23,11 @@
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/signalvar.h>
|
||||
#include <sys/rtprio.h>
|
||||
|
@ -25,10 +25,11 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
|
@ -23,10 +23,11 @@
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/queue.h>
|
||||
|
||||
|
@ -23,10 +23,11 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "namespace.h"
|
||||
#include <pthread.h>
|
||||
#include <pthread_np.h>
|
||||
@ -37,10 +38,10 @@
|
||||
__weak_reference(_pthread_main_np, pthread_main_np);
|
||||
|
||||
/*
|
||||
* Provide the equivelant to Solaris thr_main() function
|
||||
* Provide the equivalent to Solaris thr_main() function.
|
||||
*/
|
||||
int
|
||||
_pthread_main_np()
|
||||
_pthread_main_np(void)
|
||||
{
|
||||
|
||||
if (!_thr_initial)
|
||||
|
@ -25,10 +25,11 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "namespace.h"
|
||||
#include <pthread.h>
|
||||
#include <pthread_np.h>
|
||||
@ -37,7 +38,7 @@
|
||||
__weak_reference(_pthread_multi_np, pthread_multi_np);
|
||||
|
||||
int
|
||||
_pthread_multi_np()
|
||||
_pthread_multi_np(void)
|
||||
{
|
||||
|
||||
/* Return to multi-threaded scheduling mode: */
|
||||
|
@ -34,10 +34,11 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "namespace.h"
|
||||
#include <stdlib.h>
|
||||
@ -51,6 +52,9 @@
|
||||
|
||||
#include "thr_private.h"
|
||||
|
||||
_Static_assert(sizeof(struct pthread_mutex) <= PAGE_SIZE,
|
||||
"pthread_mutex is too large for off-page");
|
||||
|
||||
/*
|
||||
* For adaptive mutexes, how many times to spin doing trylock2
|
||||
* before entering the kernel to block
|
||||
|
@ -25,8 +25,6 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -59,6 +57,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "namespace.h"
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -22,11 +22,11 @@
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "namespace.h"
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
|
@ -22,10 +22,11 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
@ -26,10 +26,11 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
@ -38,6 +39,9 @@
|
||||
|
||||
#include "thr_private.h"
|
||||
|
||||
_Static_assert(sizeof(struct pthread_spinlock) <= PAGE_SIZE,
|
||||
"pthread_spinlock is too large for off-page");
|
||||
|
||||
#define SPIN_COUNT 100000
|
||||
|
||||
__weak_reference(_pthread_spin_init, pthread_spin_init);
|
||||
|
@ -25,10 +25,11 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
|
@ -22,11 +22,11 @@
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* A lockless rwlock for rtld.
|
||||
*/
|
||||
|
@ -22,10 +22,11 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
@ -35,6 +36,9 @@
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
_Static_assert(sizeof(struct pthread_rwlock) <= PAGE_SIZE,
|
||||
"pthread_rwlock is too large for off-page");
|
||||
|
||||
__weak_reference(_pthread_rwlock_destroy, pthread_rwlock_destroy);
|
||||
__weak_reference(_pthread_rwlock_init, pthread_rwlock_init);
|
||||
__weak_reference(_pthread_rwlock_rdlock, pthread_rwlock_rdlock);
|
||||
|
@ -22,10 +22,11 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -25,10 +25,11 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "namespace.h"
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
|
@ -26,10 +26,11 @@
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "namespace.h"
|
||||
#include <sys/types.h>
|
||||
#include <sys/queue.h>
|
||||
|
@ -25,10 +25,11 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "namespace.h"
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
|
@ -28,10 +28,11 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "namespace.h"
|
||||
#include <sys/param.h>
|
||||
#include <errno.h>
|
||||
|
@ -22,10 +22,11 @@
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "namespace.h"
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -25,10 +25,11 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "namespace.h"
|
||||
#include <pthread.h>
|
||||
#include <pthread_np.h>
|
||||
@ -36,7 +37,8 @@
|
||||
|
||||
__weak_reference(_pthread_single_np, pthread_single_np);
|
||||
|
||||
int _pthread_single_np()
|
||||
int
|
||||
_pthread_single_np(void)
|
||||
{
|
||||
|
||||
/* Enter single-threaded (non-POSIX) scheduling mode: */
|
||||
|
@ -22,10 +22,11 @@
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "thr_private.h"
|
||||
|
||||
|
@ -25,10 +25,11 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "namespace.h"
|
||||
#include <sys/mman.h>
|
||||
#include <signal.h>
|
||||
|
@ -25,11 +25,11 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <pthread.h>
|
||||
#include <libc_private.h>
|
||||
|
@ -23,10 +23,11 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/queue.h>
|
||||
|
@ -25,10 +25,11 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
|
@ -28,10 +28,11 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
|
@ -25,10 +25,11 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stddef.h>
|
||||
#include <pthread.h>
|
||||
|
@ -22,11 +22,11 @@
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "thr_private.h"
|
||||
#include "thr_umtx.h"
|
||||
|
||||
|
@ -25,10 +25,11 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "namespace.h"
|
||||
#include <pthread.h>
|
||||
#include <sched.h>
|
||||
|
@ -139,8 +139,8 @@ libusb20_tr_close(struct libusb20_transfer *xfer)
|
||||
free(xfer->ppBuffer);
|
||||
}
|
||||
/* reset variable fields in case the transfer is opened again */
|
||||
xfer->priv_sc0 = 0;
|
||||
xfer->priv_sc1 = 0;
|
||||
xfer->priv_sc0 = NULL;
|
||||
xfer->priv_sc1 = NULL;
|
||||
xfer->is_opened = 0;
|
||||
xfer->is_pending = 0;
|
||||
xfer->is_cancel = 0;
|
||||
|
@ -159,7 +159,7 @@ hid_use_report_desc(unsigned char *data, unsigned int size)
|
||||
report_desc_t r;
|
||||
|
||||
r = malloc(sizeof(*r) + size);
|
||||
if (r == 0) {
|
||||
if (r == NULL) {
|
||||
errno = ENOMEM;
|
||||
return (NULL);
|
||||
}
|
||||
|
@ -77,9 +77,9 @@ hid_init(const char *hidname)
|
||||
char line[100], name[100], *p, *n;
|
||||
int no;
|
||||
int lineno;
|
||||
struct usage_page *curpage = 0;
|
||||
struct usage_page *curpage = NULL;
|
||||
|
||||
if (hidname == 0)
|
||||
if (hidname == NULL)
|
||||
hidname = _PATH_HIDTABLE;
|
||||
|
||||
f = fopen(hidname, "r");
|
||||
@ -124,7 +124,7 @@ hid_init(const char *hidname)
|
||||
curpage->pagesize++;
|
||||
} else {
|
||||
if (npages >= npagesmax) {
|
||||
if (pages == 0) {
|
||||
if (pages == NULL) {
|
||||
npagesmax = 5;
|
||||
pages = malloc(npagesmax *
|
||||
sizeof (struct usage_page));
|
||||
|
@ -925,6 +925,7 @@ int
|
||||
reconnect(int dosfs, struct bootblock *boot, struct fatEntry *fat, cl_t head)
|
||||
{
|
||||
struct dosDirEntry d;
|
||||
int len;
|
||||
u_char *p;
|
||||
|
||||
if (!ask(1, "Reconnect"))
|
||||
@ -976,14 +977,15 @@ reconnect(int dosfs, struct bootblock *boot, struct fatEntry *fat, cl_t head)
|
||||
boot->NumFiles++;
|
||||
/* Ensure uniqueness of entry here! XXX */
|
||||
memset(&d, 0, sizeof d);
|
||||
(void)snprintf(d.name, sizeof(d.name), "%u", head);
|
||||
/* worst case -1 = 4294967295, 10 digits */
|
||||
len = snprintf(d.name, sizeof(d.name), "%u", head);
|
||||
d.flags = 0;
|
||||
d.head = head;
|
||||
d.size = fat[head].length * boot->ClusterSize;
|
||||
|
||||
memset(p, 0, 32);
|
||||
memset(p, ' ', 11);
|
||||
memcpy(p, d.name, strlen(d.name));
|
||||
memcpy(p, d.name, len);
|
||||
memset(p + len, ' ', 11 - len);
|
||||
memset(p + 11, 0, 32 - 11);
|
||||
p[26] = (u_char)d.head;
|
||||
p[27] = (u_char)(d.head >> 8);
|
||||
if (boot->ClustMask == CLUST32_MASK) {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user