Revert r312923 a better approach will be taken later

This commit is contained in:
bapt 2017-01-28 16:30:14 +00:00
parent 6a21064647
commit 02ac05d572
34 changed files with 333 additions and 151 deletions

View File

@ -9,7 +9,7 @@ LINKS= ${BINDIR}/ed ${BINDIR}/red
MLINKS= ed.1 red.1
.if ${MK_OPENSSL} != "no" && ${MK_ED_CRYPTO} != "no"
CFLAGS+=-DDES
CFLAGS+=-DDES -I/usr/include/private/openssl
LIBADD= crypto
.endif

View File

@ -38,6 +38,7 @@
#include <signal.h>
#include <syslog.h>
#include <unistd.h>
#include <ctype.h>
#include "dma.h"
@ -341,18 +342,41 @@ parse_addrs(struct parse_state *ps, char *s, struct queue *queue)
goto again;
}
static int
writeline(struct queue *queue, const char *line, ssize_t linelen)
{
ssize_t len;
while (linelen > 0) {
len = linelen;
if (linelen > 1000) {
len = 990;
}
if (fwrite(line, len, 1, queue->mailf) != 1)
return (-1);
if (linelen <= 1000)
break;
if (fwrite("\n", 1, 1, queue->mailf) != 1)
return (-1);
line += 990;
linelen = strlen(line);
}
return (0);
}
int
readmail(struct queue *queue, int nodot, int recp_from_header)
{
struct parse_state parse_state;
char line[1000]; /* by RFC2822 */
size_t linelen;
char *line = NULL;
ssize_t linelen;
size_t linecap = 0;
char newline[1000];
size_t error;
int had_headers = 0;
int had_from = 0;
int had_messagid = 0;
int had_date = 0;
int had_last_line = 0;
int nocopy = 0;
parse_state.state = NONE;
@ -372,24 +396,15 @@ readmail(struct queue *queue, int nodot, int recp_from_header)
return (-1);
while (!feof(stdin)) {
if (fgets(line, sizeof(line) - 1, stdin) == NULL)
newline[0] = '\0';
if ((linelen = getline(&line, &linecap, stdin)) <= 0)
break;
if (had_last_line)
errlogx(EX_DATAERR, "bad mail input format:"
" from %s (uid %d) (envelope-from %s)",
username, useruid, queue->sender);
linelen = strlen(line);
if (linelen == 0 || line[linelen - 1] != '\n') {
/*
* This line did not end with a newline character.
* If we fix it, it better be the last line of
* the file.
*/
line[linelen] = '\n';
line[linelen + 1] = 0;
had_last_line = 1;
}
if (!had_headers) {
if (linelen > 1000)
errlogx(EX_DATAERR, "bad mail input format:"
" from %s (uid %d) (envelope-from %s)",
username, useruid, queue->sender);
/*
* Unless this is a continuation, switch of
* the Bcc: nocopy flag.
@ -425,36 +440,44 @@ readmail(struct queue *queue, int nodot, int recp_from_header)
}
}
if (strcmp(line, "\n") == 0 && !had_headers) {
if (line[0] == '\n' && !had_headers) {
had_headers = 1;
while (!had_date || !had_messagid || !had_from) {
if (!had_date) {
had_date = 1;
snprintf(line, sizeof(line), "Date: %s\n", rfc822date());
snprintf(newline, sizeof(newline), "Date: %s\n", rfc822date());
} else if (!had_messagid) {
/* XXX msgid, assign earlier and log? */
had_messagid = 1;
snprintf(line, sizeof(line), "Message-Id: <%"PRIxMAX".%s.%"PRIxMAX"@%s>\n",
snprintf(newline, sizeof(newline), "Message-Id: <%"PRIxMAX".%s.%"PRIxMAX"@%s>\n",
(uintmax_t)time(NULL),
queue->id,
(uintmax_t)random(),
hostname());
} else if (!had_from) {
had_from = 1;
snprintf(line, sizeof(line), "From: <%s>\n", queue->sender);
snprintf(newline, sizeof(newline), "From: <%s>\n", queue->sender);
}
if (fwrite(line, strlen(line), 1, queue->mailf) != 1)
return (-1);
if (fwrite(newline, strlen(newline), 1, queue->mailf) != 1)
goto fail;
}
strcpy(line, "\n");
strlcpy(newline, "\n", sizeof(newline));
}
if (!nodot && linelen == 2 && line[0] == '.')
break;
if (!nocopy) {
if (fwrite(line, strlen(line), 1, queue->mailf) != 1)
return (-1);
if (newline[0] != '\0') {
if (fwrite(newline, strlen(newline), 1, queue->mailf) != 1)
goto fail;
} else {
if (writeline(queue, line, linelen) != 0)
goto fail;
}
}
}
return (0);
fail:
free(line);
return (-1);
}

View File

@ -54,10 +54,10 @@ INDXBIB?= indxbib
PIC?= pic
REFER?= refer
.for _dev in ${PRINTERDEVICE:Mascii}
ROFF.ascii?= groff -Tascii -P-c ${TRFLAGS} -mtty-char ${MACROS} ${PAGES:C/^/-o/1}
ROFF.ascii?= nroff -Tascii -P-c ${TRFLAGS} -mtty-char ${MACROS} ${PAGES:C/^/-o/1}
.endfor
.for _dev in ${PRINTERDEVICE:Nascii}
ROFF.${_dev}?= groff -T${_dev} ${TRFLAGS} ${MACROS} ${PAGES:C/^/-o/1}
ROFF.${_dev}?= nroff -T${_dev} ${TRFLAGS} ${MACROS} ${PAGES:C/^/-o/1}
.endfor
SOELIM?= soelim
TBL?= tbl

View File

@ -270,6 +270,7 @@ db_nextframe(struct amd64_frame **fp, db_addr_t *ip, struct thread *td)
*fp = (struct amd64_frame *) rbp;
}
static int
db_backtrace(struct thread *td, struct trapframe *tf, struct amd64_frame *frame,
db_addr_t pc, register_t sp, int count)
@ -384,6 +385,20 @@ db_trace_self(void)
db_backtrace(curthread, NULL, frame, callpc, 0, -1);
}
void
db_trace_self_depth(int depth)
{
struct amd64_frame *frame;
db_addr_t callpc;
register_t rbp;
__asm __volatile("movq %%rbp,%0" : "=r" (rbp));
frame = (struct amd64_frame *)rbp;
callpc = (db_addr_t)db_get_value((long)&frame->f_retaddr, 8, FALSE);
frame = frame->f_frame;
db_backtrace(curthread, NULL, frame, callpc, 0, depth);
}
int
db_trace_thread(struct thread *thr, int count)
{

View File

@ -27,6 +27,7 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/imgact.h>
#include <sys/kernel.h>
#include <sys/proc.h>
@ -38,6 +39,7 @@ __FBSDID("$FreeBSD$");
#include <machine/frame.h>
#include <machine/pcb.h>
#include <machine/vmparam.h>
#include <machine/cpu.h>
#include <compat/cloudabi/cloudabi_util.h>

View File

@ -150,7 +150,7 @@ struct ctl_lun_io_stats {
uint64_t lun_number;
uint32_t blocksize;
ctl_lun_stats_flags flags;
struct ctl_lun_io_port_stats ports[CTL_MAX_PORTS];
struct ctl_lun_io_port_stats *ports;
};
struct ctl_stats {

View File

@ -34,6 +34,8 @@
#include <sys/dtrace.h>
#include <machine/cpu.h>
#include "fbt.h"
#define FBT_PUSHL_EBP 0x55

View File

@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$");
#include <sys/socketvar.h>
#include <sys/syscallsubr.h>
#include <sys/sysproto.h>
#include <sys/seq.h>
#include <sys/systm.h>
#include <sys/unistd.h>
#include <sys/vnode.h>

View File

@ -27,6 +27,7 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/proc.h>
#include <sys/syscallsubr.h>

View File

@ -72,6 +72,14 @@ struct linux_kmem_cache {
};
#define SLAB_HWCACHE_ALIGN 0x0001
static inline void *
kmalloc_array(size_t n, size_t size, gfp_t flags)
{
if (size != 0 && n > SIZE_MAX / size)
return (NULL);
return kmalloc(n * size, flags);
}
}
static inline int
linux_kmem_ctor(void *mem, int size, void *arg, int flags)

View File

@ -1022,23 +1022,25 @@ ACPI_EXPORT_SYMBOL (AcpiDetachData)
/*******************************************************************************
*
* FUNCTION: AcpiGetData
* FUNCTION: AcpiGetDataFull
*
* PARAMETERS: ObjHandle - Namespace node
* Handler - Handler used in call to AttachData
* Handle - Handler used in call to attach_data
* Data - Where the data is returned
* Callback - function to execute before returning
*
* RETURN: Status
*
* DESCRIPTION: Retrieve data that was previously attached to a namespace node.
* DESCRIPTION: Retrieve data that was previously attached to a namespace node
* and execute a callback before returning.
*
******************************************************************************/
ACPI_STATUS
AcpiGetData (
AcpiGetDataFull (
ACPI_HANDLE ObjHandle,
ACPI_OBJECT_HANDLER Handler,
void **Data)
void **Data,
void (*Callback)(void *))
{
ACPI_NAMESPACE_NODE *Node;
ACPI_STATUS Status;
@ -1069,10 +1071,34 @@ AcpiGetData (
}
Status = AcpiNsGetAttachedData (Node, Handler, Data);
if (ACPI_SUCCESS(Status) && Callback) {
Callback(*Data);
}
UnlockAndExit:
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
return (Status);
}
ACPI_EXPORT_SYMBOL (AcpiGetDataFull)
/*******************************************************************************
*
* FUNCTION: AcpiGetData
*
* PARAMETERS: ObjHandle - Namespace node
* Handler - Handler used in call to AttachData
* Data - Where the data is returned
*
* RETURN: Status
*
* DESCRIPTION: Retrieve data that was previously attached to a namespace node.
*
******************************************************************************/
ACPI_STATUS
AcpiGetData (
ACPI_HANDLE ObjHandle,
ACPI_OBJECT_HANDLER Handler,
void **Data)
{
return (AcpiGetDataFull(ObjHandle, Handler, Data, NULL));
}
ACPI_EXPORT_SYMBOL (AcpiGetData)

View File

@ -670,6 +670,14 @@ AcpiGetData (
ACPI_OBJECT_HANDLER Handler,
void **Data))
ACPI_EXTERNAL_RETURN_STATUS (
ACPI_STATUS
AcpiGetDataFull (
ACPI_HANDLE Object,
ACPI_OBJECT_HANDLER Handler,
void **Data,
void (*Callback)(void *)))
ACPI_EXTERNAL_RETURN_STATUS (
ACPI_STATUS
AcpiDebugTrace (

View File

@ -219,6 +219,7 @@ bool db_stop_at_pc(int type, int code, bool *is_breakpoint,
bool *is_watchpoint);
#define db_strcpy strcpy
void db_trace_self(void);
void db_trace_self_depth(int);
int db_trace_thread(struct thread *, int);
bool db_value_of_name(const char *name, db_expr_t *valuep);
bool db_value_of_name_pcpu(const char *name, db_expr_t *valuep);

View File

@ -35,7 +35,6 @@
__FBSDID("$FreeBSD$");
#include <dev/drm2/drmP.h>
#include <linux/slab.h>
#if __OS_HAS_AGP
@ -209,13 +208,15 @@ int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request)
if (!dev->agp || !dev->agp->acquired)
return -EINVAL;
if (!(entry = kzalloc(sizeof(*entry), GFP_KERNEL)))
if (!(entry = malloc(sizeof(*entry), DRM_MEM_AGPLISTS, M_NOWAIT)))
return -ENOMEM;
memset(entry, 0, sizeof(*entry));
pages = (request->size + PAGE_SIZE - 1) / PAGE_SIZE;
type = (u32) request->type;
if (!(memory = agp_alloc_memory(dev->agp->bridge, type, pages << PAGE_SHIFT))) {
kfree(entry);
free(entry, DRM_MEM_AGPLISTS);
return -ENOMEM;
}
@ -375,7 +376,7 @@ int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request)
list_del(&entry->head);
drm_free_agp(entry->memory, entry->pages);
kfree(entry);
free(entry, DRM_MEM_AGPLISTS);
return 0;
}
EXPORT_SYMBOL(drm_agp_free);
@ -403,11 +404,12 @@ struct drm_agp_head *drm_agp_init(struct drm_device *dev)
{
struct drm_agp_head *head = NULL;
if (!(head = kzalloc(sizeof(*head), GFP_KERNEL)))
if (!(head = malloc(sizeof(*head), DRM_MEM_AGPLISTS, M_NOWAIT)))
return NULL;
memset((void *)head, 0, sizeof(*head));
head->bridge = agp_find_device();
if (!head->bridge) {
kfree(head);
free(head, DRM_MEM_AGPLISTS);
return NULL;
} else {
agp_get_info(head->bridge, &head->agp_info);

View File

@ -39,6 +39,9 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/shm.h>
#include <linux/vmalloc.h>
#include <linux/slab.h>
#include <dev/pci/pcireg.h>
#include <dev/drm2/drmP.h>
@ -216,7 +219,7 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset,
int ret;
int align;
map = malloc(sizeof(*map), DRM_MEM_MAPS, M_NOWAIT);
map = kmalloc(sizeof(*map), GFP_KERNEL);
if (!map)
return -ENOMEM;
@ -230,7 +233,7 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset,
* when processes fork.
*/
if ((map->flags & _DRM_REMOVABLE) && map->type != _DRM_SHM) {
free(map, DRM_MEM_MAPS);
kfree(map);
return -EINVAL;
}
DRM_DEBUG("offset = 0x%08llx, size = 0x%08lx, type = %d\n",
@ -249,7 +252,7 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset,
* constant.
*/
if ((map->offset & ((resource_size_t)PAGE_MASK)) || (map->size & (PAGE_MASK))) {
free(map, DRM_MEM_MAPS);
kfree(map);
return -EINVAL;
}
map->mtrr = -1;
@ -281,7 +284,7 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset,
list->map->size = map->size;
}
free(map, DRM_MEM_MAPS);
kfree(map);
*maplist = list;
return 0;
}
@ -298,7 +301,7 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset,
if (map->type == _DRM_REGISTERS) {
drm_core_ioremap(map, dev);
if (!map->handle) {
free(map, DRM_MEM_MAPS);
kfree(map);
return -ENOMEM;
}
}
@ -314,23 +317,23 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset,
list->map->size = map->size;
}
free(map, DRM_MEM_MAPS);
kfree(map);
*maplist = list;
return 0;
}
map->handle = malloc(map->size, DRM_MEM_MAPS, M_NOWAIT);
map->handle = vmalloc_user(map->size);
DRM_DEBUG("%lu %d %p\n",
map->size, drm_order(map->size), map->handle);
if (!map->handle) {
free(map, DRM_MEM_MAPS);
kfree(map);
return -ENOMEM;
}
map->offset = (unsigned long)map->handle;
if (map->flags & _DRM_CONTAINS_LOCK) {
/* Prevent a 2nd X Server from creating a 2nd lock */
if (dev->primary->master->lock.hw_lock != NULL) {
free(map->handle, DRM_MEM_MAPS);
free(map, DRM_MEM_MAPS);
kfree(map->handle);
kfree(map);
return -EBUSY;
}
dev->sigdata.lock = dev->primary->master->lock.hw_lock = map->handle; /* Pointer to lock */
@ -341,7 +344,7 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset,
int valid = 0;
if (!drm_core_has_AGP(dev)) {
free(map, DRM_MEM_MAPS);
kfree(map);
return -EINVAL;
}
#ifdef __linux__
@ -376,7 +379,7 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset,
}
}
if (!list_empty(&dev->agp->memory) && !valid) {
free(map, DRM_MEM_MAPS);
kfree(map);
return -EPERM;
}
DRM_DEBUG("AGP offset = 0x%08llx, size = 0x%08lx\n",
@ -389,7 +392,7 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset,
break;
case _DRM_SCATTER_GATHER:
if (!dev->sg) {
free(map, DRM_MEM_MAPS);
kfree(map);
return -EINVAL;
}
map->handle = (void *)(dev->sg->vaddr + offset);
@ -405,7 +408,7 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset,
align = PAGE_SIZE;
dmah = drm_pci_alloc(dev, map->size, align, BUS_SPACE_MAXADDR);
if (!dmah) {
free(map, DRM_MEM_MAPS);
kfree(map);
return -ENOMEM;
}
map->handle = dmah->vaddr;
@ -413,15 +416,15 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset,
map->dmah = dmah;
break;
default:
free(map, DRM_MEM_MAPS);
kfree(map);
return -EINVAL;
}
list = malloc(sizeof(*list), DRM_MEM_MAPS, M_ZERO | M_NOWAIT);
list = kzalloc(sizeof(*list), GFP_KERNEL);
if (!list) {
if (map->type == _DRM_REGISTERS)
drm_core_ioremapfree(map, dev);
free(map, DRM_MEM_MAPS);
kfree(map);
return -EINVAL;
}
list->map = map;
@ -438,8 +441,8 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset,
if (ret) {
if (map->type == _DRM_REGISTERS)
drm_core_ioremapfree(map, dev);
free(map, DRM_MEM_MAPS);
free(list, DRM_MEM_MAPS);
kfree(map);
kfree(list);
DRM_UNLOCK(dev);
return ret;
}
@ -523,7 +526,7 @@ int drm_rmmap_locked(struct drm_device *dev, struct drm_local_map *map)
list_del(&r_list->head);
drm_ht_remove_key(&dev->map_hash,
r_list->user_token >> PAGE_SHIFT);
free(r_list, DRM_MEM_MAPS);
kfree(r_list);
found = 1;
break;
}
@ -545,7 +548,7 @@ int drm_rmmap_locked(struct drm_device *dev, struct drm_local_map *map)
}
break;
case _DRM_SHM:
free(map->handle, DRM_MEM_MAPS);
kfree(map->handle);
if (master) {
if (dev->sigdata.lock == master->lock.hw_lock)
dev->sigdata.lock = NULL;
@ -564,7 +567,7 @@ int drm_rmmap_locked(struct drm_device *dev, struct drm_local_map *map)
DRM_ERROR("tried to rmmap GEM object\n");
break;
}
free(map, DRM_MEM_MAPS);
kfree(map);
return 0;
}
@ -655,16 +658,16 @@ static void drm_cleanup_buf_error(struct drm_device * dev,
drm_pci_free(dev, entry->seglist[i]);
}
}
free(entry->seglist, DRM_MEM_SEGS);
kfree(entry->seglist);
entry->seg_count = 0;
}
if (entry->buf_count) {
for (i = 0; i < entry->buf_count; i++) {
free(entry->buflist[i].dev_private, DRM_MEM_BUFS);
kfree(entry->buflist[i].dev_private);
}
free(entry->buflist, DRM_MEM_BUFS);
kfree(entry->buflist);
entry->buf_count = 0;
}
@ -761,8 +764,7 @@ int drm_addbufs_agp(struct drm_device * dev, struct drm_buf_desc * request)
return -EINVAL;
}
entry->buflist = malloc(count * sizeof(*entry->buflist), DRM_MEM_BUFS,
M_NOWAIT | M_ZERO);
entry->buflist = kcalloc(count, sizeof(*entry->buflist), GFP_KERNEL);
if (!entry->buflist) {
DRM_UNLOCK(dev);
atomic_dec(&dev->buf_alloc);
@ -790,8 +792,7 @@ int drm_addbufs_agp(struct drm_device * dev, struct drm_buf_desc * request)
buf->file_priv = NULL;
buf->dev_priv_size = dev->driver->dev_priv_size;
buf->dev_private = malloc(buf->dev_priv_size, DRM_MEM_BUFS,
M_NOWAIT | M_ZERO);
buf->dev_private = kzalloc(buf->dev_priv_size, GFP_KERNEL);
if (!buf->dev_private) {
/* Set count correctly so we free the proper amount. */
entry->buf_count = count;
@ -810,9 +811,8 @@ int drm_addbufs_agp(struct drm_device * dev, struct drm_buf_desc * request)
DRM_DEBUG("byte_count: %d\n", byte_count);
temp_buflist = realloc(dma->buflist,
(dma->buf_count + entry->buf_count) * sizeof(*dma->buflist),
DRM_MEM_BUFS, M_NOWAIT);
temp_buflist = krealloc(dma->buflist,
(dma->buf_count + entry->buf_count) * sizeof(*dma->buflist), GFP_KERNEL);
if (!temp_buflist) {
/* Free the entry because it isn't valid */
drm_cleanup_buf_error(dev, entry);
@ -912,18 +912,16 @@ int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request)
return -EINVAL;
}
entry->buflist = malloc(count * sizeof(*entry->buflist), DRM_MEM_BUFS,
M_NOWAIT | M_ZERO);
entry->buflist = kcalloc(count, sizeof(*entry->buflist), GFP_KERNEL);
if (!entry->buflist) {
DRM_UNLOCK(dev);
atomic_dec(&dev->buf_alloc);
return -ENOMEM;
}
entry->seglist = malloc(count * sizeof(*entry->seglist), DRM_MEM_SEGS,
M_NOWAIT | M_ZERO);
entry->seglist = kcalloc(count, sizeof(*entry->seglist), GFP_KERNEL);
if (!entry->seglist) {
free(entry->buflist, DRM_MEM_BUFS);
kfree(entry->buflist);
DRM_UNLOCK(dev);
atomic_dec(&dev->buf_alloc);
return -ENOMEM;
@ -932,11 +930,12 @@ int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request)
/* Keep the original pagelist until we know all the allocations
* have succeeded
*/
temp_pagelist = malloc((dma->page_count + (count << page_order)) *
sizeof(*dma->pagelist), DRM_MEM_PAGES, M_NOWAIT);
temp_pagelist = kmalloc_array(dma->page_count + (count << page_order),
sizeof(*dma->pagelist),
GFP_KERNEL);
if (!temp_pagelist) {
free(entry->buflist, DRM_MEM_BUFS);
free(entry->seglist, DRM_MEM_SEGS);
kfree(entry->buflist);
kfree(entry->seglist);
DRM_UNLOCK(dev);
atomic_dec(&dev->buf_alloc);
return -ENOMEM;
@ -960,7 +959,7 @@ int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request)
entry->buf_count = count;
entry->seg_count = count;
drm_cleanup_buf_error(dev, entry);
free(temp_pagelist, DRM_MEM_PAGES);
kfree(temp_pagelist);
DRM_UNLOCK(dev);
atomic_dec(&dev->buf_alloc);
return -ENOMEM;
@ -990,14 +989,14 @@ int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request)
buf->file_priv = NULL;
buf->dev_priv_size = dev->driver->dev_priv_size;
buf->dev_private = malloc(buf->dev_priv_size,
DRM_MEM_BUFS, M_NOWAIT | M_ZERO);
buf->dev_private = kzalloc(buf->dev_priv_size,
GFP_KERNEL);
if (!buf->dev_private) {
/* Set count correctly so we free the proper amount. */
entry->buf_count = count;
entry->seg_count = count;
drm_cleanup_buf_error(dev, entry);
free(temp_pagelist, DRM_MEM_PAGES);
kfree(temp_pagelist);
DRM_UNLOCK(dev);
atomic_dec(&dev->buf_alloc);
return -ENOMEM;
@ -1009,13 +1008,13 @@ int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request)
byte_count += PAGE_SIZE << page_order;
}
temp_buflist = realloc(dma->buflist,
(dma->buf_count + entry->buf_count) * sizeof(*dma->buflist),
DRM_MEM_BUFS, M_NOWAIT);
temp_buflist = krealloc(dma->buflist,
(dma->buf_count + entry->buf_count) *
sizeof(*dma->buflist), GFP_KERNEL);
if (!temp_buflist) {
/* Free the entry because it isn't valid */
drm_cleanup_buf_error(dev, entry);
free(temp_pagelist, DRM_MEM_PAGES);
kfree(temp_pagelist);
DRM_UNLOCK(dev);
atomic_dec(&dev->buf_alloc);
return -ENOMEM;
@ -1030,7 +1029,7 @@ int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request)
* with the new one.
*/
if (dma->page_count) {
free(dma->pagelist, DRM_MEM_PAGES);
kfree(dma->pagelist);
}
dma->pagelist = temp_pagelist;
@ -1124,8 +1123,7 @@ static int drm_addbufs_sg(struct drm_device * dev, struct drm_buf_desc * request
return -EINVAL;
}
entry->buflist = malloc(count * sizeof(*entry->buflist), DRM_MEM_BUFS,
M_NOWAIT | M_ZERO);
entry->buflist = kcalloc(count, sizeof(*entry->buflist), GFP_KERNEL);
if (!entry->buflist) {
DRM_UNLOCK(dev);
atomic_dec(&dev->buf_alloc);
@ -1154,8 +1152,7 @@ static int drm_addbufs_sg(struct drm_device * dev, struct drm_buf_desc * request
buf->file_priv = NULL;
buf->dev_priv_size = dev->driver->dev_priv_size;
buf->dev_private = malloc(buf->dev_priv_size, DRM_MEM_BUFS,
M_NOWAIT | M_ZERO);
buf->dev_private = kzalloc(buf->dev_priv_size, GFP_KERNEL);
if (!buf->dev_private) {
/* Set count correctly so we free the proper amount. */
entry->buf_count = count;
@ -1174,9 +1171,9 @@ static int drm_addbufs_sg(struct drm_device * dev, struct drm_buf_desc * request
DRM_DEBUG("byte_count: %d\n", byte_count);
temp_buflist = realloc(dma->buflist,
(dma->buf_count + entry->buf_count) * sizeof(*dma->buflist),
DRM_MEM_BUFS, M_NOWAIT);
temp_buflist = krealloc(dma->buflist,
(dma->buf_count + entry->buf_count) *
sizeof(*dma->buflist), GFP_KERNEL);
if (!temp_buflist) {
/* Free the entry because it isn't valid */
drm_cleanup_buf_error(dev, entry);
@ -1280,8 +1277,7 @@ static int drm_addbufs_fb(struct drm_device * dev, struct drm_buf_desc * request
return -EINVAL;
}
entry->buflist = malloc(count * sizeof(*entry->buflist), DRM_MEM_BUFS,
M_NOWAIT | M_ZERO);
entry->buflist = kzalloc(count * sizeof(*entry->buflist), GFP_KERNEL);
if (!entry->buflist) {
DRM_UNLOCK(dev);
atomic_dec(&dev->buf_alloc);
@ -1309,8 +1305,7 @@ static int drm_addbufs_fb(struct drm_device * dev, struct drm_buf_desc * request
buf->file_priv = NULL;
buf->dev_priv_size = dev->driver->dev_priv_size;
buf->dev_private = malloc(buf->dev_priv_size, DRM_MEM_BUFS,
M_NOWAIT | M_ZERO);
buf->dev_private = kmalloc(buf->dev_priv_size, GFP_KERNEL);
if (!buf->dev_private) {
/* Set count correctly so we free the proper amount. */
entry->buf_count = count;
@ -1329,9 +1324,8 @@ static int drm_addbufs_fb(struct drm_device * dev, struct drm_buf_desc * request
DRM_DEBUG("byte_count: %d\n", byte_count);
temp_buflist = realloc(dma->buflist,
(dma->buf_count + entry->buf_count) * sizeof(*dma->buflist),
DRM_MEM_BUFS, M_NOWAIT);
temp_buflist = krealloc(dma->buflist,
(dma->buf_count + entry->buf_count) * sizeof(*dma->buflist), GFP_KERNEL);
if (!temp_buflist) {
/* Free the entry because it isn't valid */
drm_cleanup_buf_error(dev, entry);

View File

@ -37,6 +37,7 @@
__FBSDID("$FreeBSD$");
#include <dev/drm2/drmP.h>
#include <linux/slab.h>
/**
* Initialize the DMA data.
@ -89,18 +90,17 @@ void drm_dma_takedown(struct drm_device *dev)
drm_pci_free(dev, dma->bufs[i].seglist[j]);
}
}
free(dma->bufs[i].seglist, DRM_MEM_SEGS);
kfree(dma->bufs[i].seglist);
}
if (dma->bufs[i].buf_count) {
for (j = 0; j < dma->bufs[i].buf_count; j++) {
free(dma->bufs[i].buflist[j].dev_private,
DRM_MEM_BUFS);
kfree(dma->bufs[i].buflist[j].dev_private);
}
free(dma->bufs[i].buflist, DRM_MEM_BUFS);
kfree(dma->bufs[i].buflist);
}
}
free(dma->buflist, DRM_MEM_BUFS);
kfree(dma->buflist);
free(dma->pagelist, DRM_MEM_PAGES);
free(dev->dma, DRM_MEM_DRIVER);
dev->dma = NULL;

View File

@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$");
#include <sys/sysent.h>
#include <linux/slab.h>
#include <dev/drm2/drmP.h>
#include <dev/drm2/drm_core.h>
#include <dev/drm2/drm_global.h>
@ -212,7 +211,7 @@ int drm_lastclose(struct drm_device * dev)
if (entry->bound)
drm_unbind_agp(entry->memory);
drm_free_agp(entry->memory, entry->pages);
kfree(entry);
free(entry, DRM_MEM_AGPLISTS);
}
INIT_LIST_HEAD(&dev->agp->memory);

View File

@ -16,7 +16,6 @@ MALLOC_DEFINE(DRM_MEM_MAGIC, "drm_magic", "DRM MAGIC Data Structures");
MALLOC_DEFINE(DRM_MEM_MINOR, "drm_minor", "DRM MINOR Data Structures");
MALLOC_DEFINE(DRM_MEM_IOCTLS, "drm_ioctls", "DRM IOCTL Data Structures");
MALLOC_DEFINE(DRM_MEM_MAPS, "drm_maps", "DRM MAP Data Structures");
MALLOC_DEFINE(DRM_MEM_BUFS, "drm_bufs", "DRM BUFFER Data Structures");
MALLOC_DEFINE(DRM_MEM_SEGS, "drm_segs", "DRM SEGMENTS Data Structures");
MALLOC_DEFINE(DRM_MEM_PAGES, "drm_pages", "DRM PAGES Data Structures");
MALLOC_DEFINE(DRM_MEM_FILES, "drm_files", "DRM FILE Data Structures");
@ -24,6 +23,7 @@ MALLOC_DEFINE(DRM_MEM_QUEUES, "drm_queues", "DRM QUEUE Data Structures");
MALLOC_DEFINE(DRM_MEM_CMDS, "drm_cmds", "DRM COMMAND Data Structures");
MALLOC_DEFINE(DRM_MEM_MAPPINGS, "drm_mapping", "DRM MAPPING Data Structures");
MALLOC_DEFINE(DRM_MEM_BUFLISTS, "drm_buflists", "DRM BUFLISTS Data Structures");
MALLOC_DEFINE(DRM_MEM_AGPLISTS, "drm_agplists", "DRM AGPLISTS Data Structures");
MALLOC_DEFINE(DRM_MEM_CTXBITMAP, "drm_ctxbitmap",
"DRM CTXBITMAP Data Structures");
MALLOC_DEFINE(DRM_MEM_SGLISTS, "drm_sglists", "DRM SGLISTS Data Structures");
@ -495,5 +495,4 @@ MODULE_VERSION(drmn, 1);
MODULE_DEPEND(drmn, agp, 1, 1, 1);
MODULE_DEPEND(drmn, pci, 1, 1, 1);
MODULE_DEPEND(drmn, mem, 1, 1, 1);
MODULE_DEPEND(drmn, linuxkpi, 1, 1, 1);
MODULE_DEPEND(drmn, iicbus, 1, 1, 1);

View File

@ -544,7 +544,6 @@ MALLOC_DECLARE(DRM_MEM_MAGIC);
MALLOC_DECLARE(DRM_MEM_MINOR);
MALLOC_DECLARE(DRM_MEM_IOCTLS);
MALLOC_DECLARE(DRM_MEM_MAPS);
MALLOC_DECLARE(DRM_MEM_BUFS);
MALLOC_DECLARE(DRM_MEM_SEGS);
MALLOC_DECLARE(DRM_MEM_PAGES);
MALLOC_DECLARE(DRM_MEM_FILES);
@ -552,6 +551,7 @@ MALLOC_DECLARE(DRM_MEM_QUEUES);
MALLOC_DECLARE(DRM_MEM_CMDS);
MALLOC_DECLARE(DRM_MEM_MAPPINGS);
MALLOC_DECLARE(DRM_MEM_BUFLISTS);
MALLOC_DECLARE(DRM_MEM_AGPLISTS);
MALLOC_DECLARE(DRM_MEM_CTXBITMAP);
MALLOC_DECLARE(DRM_MEM_SGLISTS);
MALLOC_DECLARE(DRM_MEM_MM);

View File

@ -36,7 +36,6 @@ __FBSDID("$FreeBSD$");
#include <dev/drm2/drmP.h>
#include <dev/drm2/drm_core.h>
#include <linux/slab.h>
#ifdef DRM_DEBUG_DEFAULT_ON
unsigned int drm_debug = (DRM_DEBUGBITS_DEBUG | DRM_DEBUGBITS_KMS |
@ -316,7 +315,7 @@ void drm_cancel_fill_in_dev(struct drm_device *dev)
DRM_MTRR_WC);
DRM_DEBUG("mtrr_del=%d\n", retval);
}
kfree(dev->agp);
free(dev->agp, DRM_MEM_AGPLISTS);
dev->agp = NULL;
drm_ht_remove(&dev->map_hash);
@ -468,7 +467,7 @@ void drm_put_dev(struct drm_device *dev)
drm_sysctl_cleanup(dev);
if (drm_core_has_AGP(dev) && dev->agp) {
kfree(dev->agp);
free(dev->agp, DRM_MEM_AGPLISTS);
dev->agp = NULL;
}

View File

@ -3081,7 +3081,7 @@ nfsrv_openctrl(struct nfsrv_descript *nd, vnode_t vp,
new_deleg->ls_stateid.other[2] = delegstateidp->other[2]
= nfsrv_nextstateindex(clp);
if (writedeleg && !NFSVNO_EXRDONLY(exp) &&
(nfsrv_writedelegifpos || !readonly) &&
(nfsrv_writedelegifpos && !readonly) &&
(new_stp->ls_flags & NFSLCK_WANTRDELEG) == 0) {
new_deleg->ls_flags = (NFSLCK_DELEGWRITE |
NFSLCK_READACCESS | NFSLCK_WRITEACCESS);
@ -3153,7 +3153,7 @@ nfsrv_openctrl(struct nfsrv_descript *nd, vnode_t vp,
delegstateidp->other[2]
= nfsrv_nextstateindex(clp);
if (writedeleg && !NFSVNO_EXRDONLY(exp) &&
(nfsrv_writedelegifpos || !readonly) &&
(nfsrv_writedelegifpos && !readonly) &&
((nd->nd_flag & ND_NFSV41) == 0 ||
(new_stp->ls_flags & NFSLCK_WANTRDELEG) ==
0)) {

View File

@ -69,6 +69,7 @@ __FBSDID("$FreeBSD$");
#include <sys/signalvar.h>
#include <sys/kdb.h>
#include <sys/stat.h>
#include <sys/seq.h>
#include <sys/sx.h>
#include <sys/syscallsubr.h>
#include <sys/sysctl.h>
@ -4074,6 +4075,13 @@ invfo_sendfile(struct file *fp, int sockfd, struct uio *hdr_uio,
return (EINVAL);
}
bool
fd_modified(struct filedesc *fdp, int fd, uint32_t seq)
{
return (!seq_consistent(fd_seq(fdp->fd_files, fd), seq));
}
/*-------------------------------------------------------------------*/
/*

View File

@ -722,6 +722,14 @@ vpanic(const char *fmt, va_list ap)
spinlock_enter();
#if 0
/***** DEBUGGING DRM *****/
doadump(0);
EVENTHANDLER_INVOKE(shutdown_final, RB_NOSYNC);
/************************/
#endif
#ifdef SMP
/*
* stop_cpus_hard(other_cpus) should prevent multiple CPUs from

View File

@ -48,8 +48,6 @@ SRCS = \
ati_pcigart.c
#ttm_page_alloc_dma.c
CFLAGS+= -I${.CURDIR}/../../../compat/linuxkpi/common/include
.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_ARCH} == "powerpc64"
SRCS += drm_ioc32.c
.endif

View File

@ -41,6 +41,11 @@ SYSINCS+= stat.h
SRCS+= futimens.c utimensat.c
.endif
.if !exists(/usr/include/capsicum_helpers.h)
.PATH: ${.CURDIR}/../../lib/libcapsicum/
INCS+= capsicum_helpers.h
.endif
.if empty(SRCS)
SRCS= dummy.c
.endif

View File

@ -1,4 +1,4 @@
# $FreeBSD$
cldr ~/unicode/cldr/30.0.3
unidata ~/unicode/UNIDATA/9.0.0
cldr /home/bapt/unicode/cldr/30.0.3
unidata /home/bapt/unicode/UNIDATA/9.0.0

View File

@ -52,6 +52,9 @@ _POSIX_V6_LPBIG_OFFBIG_CFLAGS, _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS
_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS
_POSIX_V6_LPBIG_OFFBIG_LIBS, _CS_POSIX_V6_LPBIG_OFFBIG_LIBS
_POSIX_V6_WIDTH_RESTRICTED_ENVS, _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS
DARWIN_USER_DIR, _CS_DARWIN_USER_DIR
DARWIN_USER_TEMP_DIR, _CS_DARWIN_USER_TEMP_DIR
DARWIN_USER_CACHE_DIR, _CS_DARWIN_USER_CACHE_DIR
%%
int
find_confstr(const char *name, int *key)

View File

@ -187,4 +187,3 @@ do_pathconf(const char *name, int key, const char *path)
else
printf("%ld\n", value);
}

View File

@ -9,6 +9,9 @@
#include <string.h>
#include <limits.h>
#ifdef APPLE_GETCONF_UNDERSCORE
#include <alloca.h>
#endif /* APPLE_GETCONF_UNDERSCORE */
#include "getconf.h"
@ -20,11 +23,11 @@ static const struct map *in_word_set(const char *str);
%}
struct map { const char *name; intmax_t value; int valid; };
%%
_POSIX_CLOCKRES_MIN, _POSIX_CLOCKRES_MIN
_POSIX_AIO_LISTIO_MAX, _POSIX_AIO_LISTIO_MAX
_POSIX_AIO_MAX, _POSIX_AIO_MAX
_POSIX_ARG_MAX, _POSIX_ARG_MAX
_POSIX_CHILD_MAX, _POSIX_CHILD_MAX
_POSIX_CLOCKRES_MIN, _POSIX_CLOCKRES_MIN
_POSIX_DELAYTIMER_MAX, _POSIX_DELAYTIMER_MAX
_POSIX_HOST_NAME_MAX, _POSIX_HOST_NAME_MAX
_POSIX_LINK_MAX, _POSIX_LINK_MAX
@ -64,7 +67,7 @@ _POSIX2_BC_SCALE_MAX, _POSIX2_BC_SCALE_MAX
_POSIX2_BC_STRING_MAX, _POSIX2_BC_STRING_MAX
_POSIX2_CHARCLASS_NAME_MAX, _POSIX2_CHARCLASS_NAME_MAX
_POSIX2_COLL_WEIGHTS_MAX, _POSIX2_COLL_WEIGHTS_MAX
_POSIX2_EXPR_NEXT_MAX, _POSIX2_EXPR_NEST_MAX
_POSIX2_EXPR_NEST_MAX, _POSIX2_EXPR_NEST_MAX
_POSIX2_LINE_MAX, _POSIX2_LINE_MAX
_POSIX2_RE_DUP_MAX, _POSIX2_RE_DUP_MAX
_XOPEN_IOV_MAX, _XOPEN_IOV_MAX
@ -105,6 +108,9 @@ int
find_limit(const char *name, intmax_t *value)
{
const struct map *rv;
#ifdef APPLE_GETCONF_UNDERSCORE
char *alt;
#endif /* APPLE_GETCONF_UNDERSCORE */
rv = in_word_set(name);
if (rv != NULL) {
@ -114,5 +120,23 @@ find_limit(const char *name, intmax_t *value)
}
return -1;
}
#ifdef APPLE_GETCONF_UNDERSCORE
if(*name == '_')
alt = (char *)name + 1;
else {
if((alt = (char *)alloca(strlen(name) + 2)) == NULL)
return 0;
*alt = '_';
strcpy(alt + 1, name);
}
rv = in_word_set(alt);
if (rv != NULL) {
if (rv->valid) {
*value = rv->value;
return 1;
}
return -1;
}
#endif /* APPLE_GETCONF_UNDERSCORE */
return 0;
}

View File

@ -9,6 +9,9 @@
#include <string.h>
#include <unistd.h>
#ifdef APPLE_GETCONF_UNDERSCORE
#include <alloca.h>
#endif /* APPLE_GETCONF_UNDERSCORE */
#include "getconf.h"
@ -20,17 +23,10 @@ static const struct map *in_word_set(const char *str);
%}
struct map { const char *name; int key; int valid; };
%%
ACL_EXTENDED, _PC_ACL_EXTENDED
ACL_NFS4, _PC_ACL_NFS4
ACL_PATH_MAX, _PC_ACL_PATH_MAX
CAP_PRESENT, _PC_CAP_PRESENT
FILESIZEBITS, _PC_FILESIZEBITS
INF_PRESENT, _PC_INF_PRESENT
LINK_MAX, _PC_LINK_MAX
MAC_PRESENT, _PC_MAC_PRESENT
MAX_CANON, _PC_MAX_CANON
MAX_INPUT, _PC_MAX_INPUT
MIN_HOLE_SIZE, _PC_MIN_HOLE_SIZE
NAME_MAX, _PC_NAME_MAX
PATH_MAX, _PC_PATH_MAX
PIPE_BUF, _PC_PIPE_BUF
@ -39,24 +35,28 @@ POSIX_REC_INCR_XFER_SIZE, _PC_REC_INCR_XFER_SIZE
POSIX_REC_MAX_XFER_SIZE, _PC_REC_MAX_XFER_SIZE
POSIX_REC_MIN_XFER_SIZE, _PC_REC_MIN_XFER_SIZE
POSIX_REC_XFER_ALIGN, _PC_REC_XFER_ALIGN
POSIX2_SYMLINKS, _PC_2_SYMLINKS
SYMLINK_MAX, _PC_SYMLINK_MAX
TRUSTEDBSD_ACL_EXTENDED, _PC_ACL_EXTENDED
TRUSTEDBSD_ACL_NFS4, _PC_ACL_NFS4
TRUSTEDBSD_ACL_PATH_MAX, _PC_ACL_PATH_MAX
TRUSTEDBSD_CAP_PRESENT, _PC_CAP_PRESENT
TRUSTEDBSD_INF_PRESENT, _PC_INF_PRESENT
TRUSTEDBSD_MAC_PRESENT, _PC_MAC_PRESENT
_POSIX_ASYNC_IO, _PC_ASYNC_IO
_POSIX_CHOWN_RESTRICTED, _PC_CHOWN_RESTRICTED
_POSIX_NO_TRUNC, _PC_NO_TRUNC
_POSIX_VDISABLE, _PC_VDISABLE
_POSIX_ASYNC_IO, _PC_ASYNC_IO
_POSIX_PATH_MAX, _PC_PATH_MAX
_POSIX_PRIO_IO, _PC_PRIO_IO
_POSIX_SYNC_IO, _PC_SYNC_IO
_POSIX_VDISABLE, _PC_VDISABLE
%%
int
find_pathconf(const char *name, int *key)
{
const struct map *rv;
#ifdef APPLE_GETCONF_UNDERSCORE
char *alt;
#endif /* APPLE_GETCONF_UNDERSCORE */
rv = in_word_set(name);
if (rv != NULL) {
@ -66,5 +66,23 @@ find_pathconf(const char *name, int *key)
}
return -1;
}
#ifdef APPLE_GETCONF_UNDERSCORE
if(*name == '_')
alt = (char *)name + 1;
else {
if((alt = (char *)alloca(strlen(name) + 2)) == NULL)
return 0;
*alt = '_';
strcpy(alt + 1, name);
}
rv = in_word_set(alt);
if (rv != NULL) {
if (rv->valid) {
*key = rv->key;
return 1;
}
return -1;
}
#endif /* APPLE_GETCONF_UNDERSCORE */
return 0;
}

View File

@ -30,11 +30,14 @@ static const struct map *in_word_set(const char *str);
* be updated. (We cheat here and define the supported environments
* statically.)
*/
#if defined(__sparc64__) || defined(__amd64__)
#if defined(__alpha__) || defined(__sparc64__)
#define have_LP64_OFF64 NULL
#elif defined(__APPLE__)
#define have_LP64_OFF64 NULL
#define have_LPBIG_OFFBIG NULL
#endif
#if defined(__i386__) || defined(__powerpc__)
#if defined(__i386__) || defined(__powerpc__) || defined(__x86_64__)
#define have_ILP32_OFFBIG NULL
#endif
@ -44,11 +47,11 @@ struct map { const char *name; const char *alt_path; int valid; };
POSIX_V6_ILP32_OFF32, notdef
POSIX_V6_ILP32_OFFBIG, have_ILP32_OFFBIG
POSIX_V6_LP64_OFF64, have_LP64_OFF64
POSIX_V6_LPBIG_OFFBIG, notdef
POSIX_V6_LPBIG_OFFBIG, have_LPBIG_OFFBIG
_POSIX_V6_ILP32_OFF32, notdef
_POSIX_V6_ILP32_OFFBIG, have_ILP32_OFFBIG
_POSIX_V6_LP64_OFF64, have_LP64_OFF64
_POSIX_V6_LPBIG_OFFBIG, notdef
_POSIX_V6_LPBIG_OFFBIG, have_LPBIG_OFFBIG
%%
int
find_progenv(const char *name, const char **alt_path)

View File

@ -9,6 +9,9 @@
#include <string.h>
#include <unistd.h>
#ifdef APPLE_GETCONF_UNDERSCORE
#include <alloca.h>
#endif /* APPLE_GETCONF_UNDERSCORE */
#include "getconf.h"
@ -70,9 +73,16 @@ _POSIX2_C_VERSION, _SC_2_C_VERSION
_POSIX2_FORT_DEV, _SC_2_FORT_DEV
_POSIX2_FORT_RUN, _SC_2_FORT_RUN
_POSIX2_LOCALEDEF, _SC_2_LOCALEDEF
_POSIX2_PBS, _SC_PBS
_POSIX2_PBS_ACCOUNTING, _SC_PBS_ACCOUNTING
_POSIX2_PBS_CHECKPOINT, _SC_PBS_CHECKPOINT
_POSIX2_PBS_LOCATE, _SC_PBS_LOCATE
_POSIX2_PBS_MESSAGE, _SC_PBS_MESSAGE
_POSIX2_PBS_TRACK, _SC_PBS_TRACK
_POSIX2_SW_DEV, _SC_2_SW_DEV
_POSIX2_UPE, _SC_2_UPE
_POSIX2_VERSION, _SC_2_VERSION
_POSIX_ADVISORY_INFO, _SC_ADVISORY_INFO
_POSIX_ASYNCHRONOUS_IO, _SC_ASYNCHRONOUS_IO
_POSIX_BARRIERS, _SC_BARRIERS
_POSIX_CLOCK_SELECTION, _SC_CLOCK_SELECTION
@ -89,6 +99,7 @@ _POSIX_MESSAGE_PASSING, _SC_MESSAGE_PASSING
_POSIX_MONOTONIC_CLOCK, _SC_MONOTONIC_CLOCK
_POSIX_PRIORITIZED_IO, _SC_PRIORITIZED_IO
_POSIX_PRIORITY_SCHEDULING, _SC_PRIORITY_SCHEDULING
_POSIX_RAW_SOCKETS, _SC_RAW_SOCKETS
_POSIX_READER_WRITER_LOCKS, _SC_READER_WRITER_LOCKS
_POSIX_REALTIME_SIGNALS, _SC_REALTIME_SIGNALS
_POSIX_REGEXP, _SC_REGEXP
@ -99,6 +110,7 @@ _POSIX_SHELL, _SC_SHELL
_POSIX_SPAWN, _SC_SPAWN
_POSIX_SPIN_LOCKS, _SC_SPIN_LOCKS
_POSIX_SPORADIC_SERVER, _SC_SPORADIC_SERVER
_POSIX_SS_REPL_MAX, _SC_SS_REPL_MAX
_POSIX_SYNCHRONIZED_IO, _SC_SYNCHRONIZED_IO
_POSIX_THREADS, _SC_THREADS
_POSIX_THREAD_ATTR_STACKADDR, _SC_THREAD_ATTR_STACKADDR
@ -111,23 +123,28 @@ _POSIX_THREAD_PROCESS_SHARED, _SC_THREAD_PROCESS_SHARED
_POSIX_THREAD_SAFE_FUNCTIONS, _SC_THREAD_SAFE_FUNCTIONS
_POSIX_THREAD_SPORADIC_SERVER, _SC_THREAD_SPORADIC_SERVER
_POSIX_TIMEOUTS, _SC_TIMEOUTS
_POSIX_TIMERS, _SC_TIMERS
_POSIX_TRACE, _SC_TRACE
_POSIX_TRACE_EVENT_FILTER, _SC_TRACE_EVENT_FILTER
_POSIX_TRACE_EVENT_NAME_MAX, _SC_TRACE_EVENT_NAME_MAX
_POSIX_TRACE_INHERIT, _SC_TRACE_INHERIT
_POSIX_TRACE_LOG, _SC_TRACE_LOG
_POSIX_TIMERS, _SC_TIMERS
_POSIX_TRACE_NAME_MAX, _SC_TRACE_NAME_MAX
_POSIX_TRACE_SYS_MAX, _SC_TRACE_SYS_MAX
_POSIX_TRACE_USER_EVENT_MAX, _SC_TRACE_USER_EVENT_MAX
_POSIX_TYPED_MEMORY_OBJECTS, _SC_TYPED_MEMORY_OBJECTS
_POSIX_VERSION, _SC_VERSION
_POSIX_V6_ILP32_OFF32, _SC_V6_ILP32_OFF32
_POSIX_V6_ILP32_OFFBIG, _SC_V6_ILP32_OFFBIG
_POSIX_V6_LP64_OFF64, _SC_V6_LP64_OFF64
_POSIX_V6_LPBIG_OFFBIG, _SC_V6_LPBIG_OFFBIG
_POSIX_VERSION, _SC_VERSION
_XOPEN_CRYPT, _SC_XOPEN_CRYPT
_XOPEN_ENH_I18N, _SC_XOPEN_ENH_I18N
_XOPEN_LEGACY, _SC_XOPEN_LEGACY
_XOPEN_REALTIME, _SC_XOPEN_REALTIME
_XOPEN_REALTIME_THREADS, _SC_XOPEN_REALTIME_THREADS
_XOPEN_SHM, _SC_XOPEN_SHM
_XOPEN_STREAMS, _SC_XOPEN_STREAMS
_XOPEN_UNIX, _SC_XOPEN_UNIX
_XOPEN_VERSION, _SC_XOPEN_VERSION
_XOPEN_XCU_VERSION, _SC_XCU_VERSION
@ -136,6 +153,9 @@ int
find_sysconf(const char *name, int *key)
{
const struct map *rv;
#ifdef APPLE_GETCONF_UNDERSCORE
char *alt;
#endif /* APPLE_GETCONF_UNDERSCORE */
rv = in_word_set(name);
if (rv != NULL) {
@ -145,5 +165,23 @@ find_sysconf(const char *name, int *key)
}
return -1;
}
#ifdef APPLE_GETCONF_UNDERSCORE
if(*name == '_')
alt = (char *)name + 1;
else {
if((alt = (char *)alloca(strlen(name) + 2)) == NULL)
return 0;
*alt = '_';
strcpy(alt + 1, name);
}
rv = in_word_set(alt);
if (rv != NULL) {
if (rv->valid) {
*key = rv->key;
return 1;
}
return -1;
}
#endif /* APPLE_GETCONF_UNDERSCORE */
return 0;
}

View File

@ -167,7 +167,7 @@ init_runtime_env(struct configuration *config)
retval = calloc(1, sizeof(*retval));
assert(retval != NULL);
retval->sockfd = socket(PF_LOCAL, SOCK_STREAM, 0);
retval->sockfd = socket(PF_LOCAL, SOCK_STREAM|SOCK_NONBLOCK, 0);
if (config->force_unlink == 1)
unlink(config->socket_path);
@ -198,7 +198,6 @@ init_runtime_env(struct configuration *config)
*/
chmod(config->socket_path, config->socket_mode);
listen(retval->sockfd, -1);
fcntl(retval->sockfd, F_SETFL, O_NONBLOCK);
retval->queue = kqueue();
assert(retval->queue != -1);

View File

@ -189,7 +189,7 @@ open_nscd_connection__(struct nscd_connection_params const *params)
TRACE_IN(open_nscd_connection);
assert(params != NULL);
client_socket = socket(PF_LOCAL, SOCK_STREAM, 0);
client_socket = socket(PF_LOCAL, SOCK_STREAM|SOCK_NONBLOCK, 0);
client_address.sun_family = PF_LOCAL;
strlcpy(client_address.sun_path, params->socket_path,
sizeof(client_address.sun_path));
@ -203,7 +203,6 @@ open_nscd_connection__(struct nscd_connection_params const *params)
TRACE_OUT(open_nscd_connection);
return (NULL);
}
fcntl(client_socket, F_SETFL, O_NONBLOCK);
retval = calloc(1, sizeof(*retval));
assert(retval != NULL);