type stringclasses 5
values | content stringlengths 9 163k |
|---|---|
includes | #include <stdarg.h> |
includes | #include <time.h> |
includes |
#include <dispatch/dispatch.h> |
includes | #include <dispatch/private.h> |
includes |
#include <bsdtests.h> |
defines | #define ALLOC_SIZE ((size_t)(1024*1024*1ul)) // 1MB |
defines | #define NOTIFICATIONS 1 |
defines | #define ALLOC_SIZE ((size_t)(1024*1024*20ul)) // 20MB |
defines | #define NOTIFICATIONS 2 |
defines | #define pg2mb(p) ((p) * ALLOC_SIZE/(1024*1024)) |
defines | #define MAXMEM ((size_t)SIZE_MAX) |
defines | #define MAXMEM ((size_t)(3200ul*1024*1024)) // 3200MB |
defines |
#define log_msg(msg, ...) \ |
functions | bool
dispatch_test_check_evfilt_vm(void)
{
int kq = kqueue();
assert(kq != -1);
struct kevent ke = {
.filter = EVFILT_VM,
.flags = EV_ADD|EV_ENABLE|EV_RECEIPT,
.fflags = NOTE_VM_PRESSURE,
} |
functions | void
cleanup(void)
{
dispatch_source_cancel(vm_source);
dispatch_release(vm_source);
dispatch_release(vm_queue);
int32_t pc = 0, i;
for (i = 0; i < max_page_count; ++i) {
if (pages[i]) {
pc++;
free(pages[i]);
} |
functions | int
main(void)
{
dispatch_test_start("Dispatch VM Pressure test"
" - No DISPATCH_SOURCE_TYPE_VM");
test_stop();
return 0;
} |
main | int
main(void)
{
dispatch_test_start("Dispatch VM Pressure test"); // rdar://problem/7000945
if (!dispatch_test_check_evfilt_vm()) {
test_skip("EVFILT_VM not supported");
test_stop();
return 0;
} |
defines |
#define TEMPLATE "CON/S,TIME/N,FRAME/N" |
defines | #define OPT_CONSOLE 0 |
defines | #define OPT_TIME 1 |
defines | #define OPT_FRAME 2 |
defines | #define OPT_COUNT 3 |
defines |
#define PASSED "\033[60G[\033[1;32mPASS\033[0;39m]\n\r" |
defines | #define FAILED "\033[60G[\033[1;31mFAIL\033[0;39m]\n\r" |
structs | struct GlobalData
{
APTR SysBase;
APTR DOSBase;
APTR UtilBase;
}; |
functions | DOSIO main(pSysBase SysBase)
{
APTR DOSBase;
DOSIO rc = RETURN_ERROR;
UINT32 opts[OPT_COUNT];
struct RDargs* rdargs;
struct GlobalData gd;
if ( (DOSBase = OpenLibrary("dos.library", 0)) )
{
BOOL con = TRUE;
APTR UtilBase = OpenLibrary("utility.library", 0);
gd.UtilBase = UtilBase;
gd.SysBase = SysBas... |
functions | else if (x < 0 || y < 0 || y >= FRAME_HEIGHT || x >= FRAME_WIDTH) {
/* Fill all other areas with background */
color = ',';
} |
functions | endif
if (clear_screen) {
if (con)
{
sprintf(&gd, buffer, "\033[?25h\033[0m\033[H\033[2J");
PrintCon(&gd, io, buffer);
} |
functions | void _prbuf(INT32 ch, INT8 **str)
{
*(*str)++ = (char)ch;
} |
functions | int sprintf(struct GlobalData *gd, char* str, char *fmt,...)
{
APTR SysBase = gd->SysBase;
APTR UtilBase = gd->UtilBase;
va_list pvar;
va_start(pvar, fmt);
RawDoFmt((const char *)fmt, pvar,(void(*)()) _prbuf, (APTR) str);
va_end(pvar);
return Strlen((STRPTR)str);
} |
functions | void PrintCon(struct GlobalData *gd, pIOStdReq io, STRPTR string)
{
APTR SysBase = gd->SysBase;
APTR UtilBase = gd->UtilBase;
APTR DOSBase = gd->DOSBase;
io->io_Command = CMD_WRITE;
io->io_Length = Strlen(string);
io->io_Data = string;
INT32 ret = DoIO(io);
if (ret || (io->io_Length != io->io_Actual)) Printf(... |
functions | void printf2(struct GlobalData *gd, pIOStdReq io, char *fmt,...)
{
APTR SysBase = gd->SysBase;
APTR UtilBase = gd->UtilBase;
APTR DOSBase = gd->DOSBase;
char buffer[256];
va_list pvar;
va_start(pvar, fmt);
sprintf(gd, buffer, pvar);
va_end(pvar);
INT32 i = sprintf(gd, buffer, fmt);
Printf("i=%d\n",i);
// P... |
includes |
#include <math.h> |
includes | #include <stdio.h> |
structs | struct tex_op_args
{
GLenum input[3];
GLenum mapping[3];
GLenum component_usage[3];
}; |
functions | void nvts_activate_dimensions(const struct wined3d_state *state, DWORD stage, struct wined3d_context *context)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
BOOL bumpmap = FALSE;
if (stage > 0
&& (state->texture_states[stage - 1][WINED3D_TSS_COLOR_OP] == WINED3D_TOP_BUMPENVMAP_LUM... |
functions | GLenum d3dta_to_combiner_input(DWORD d3dta, DWORD stage, INT texture_idx) {
switch (d3dta) {
case WINED3DTA_DIFFUSE:
return GL_PRIMARY_COLOR_NV;
case WINED3DTA_CURRENT:
if (stage) return GL_SPARE0_NV;
else return GL_PRIMARY_COLOR_NV;
case WINED3DTA_TEXTU... |
functions | GLenum invert_mapping(GLenum mapping) {
if (mapping == GL_UNSIGNED_INVERT_NV) return GL_UNSIGNED_IDENTITY_NV;
else if (mapping == GL_UNSIGNED_IDENTITY_NV) return GL_UNSIGNED_INVERT_NV;
FIXME("Unhandled mapping %#x\n", mapping);
return mapping;
} |
functions | void get_src_and_opr_nvrc(DWORD stage, DWORD arg, BOOL is_alpha, GLenum* input, GLenum* mapping, GLenum *component_usage, INT texture_idx) {
/* The WINED3DTA_COMPLEMENT flag specifies the complement of the input should
* be used. */
if (arg & WINED3DTA_COMPLEMENT) *mapping = GL_UNSIGNED_INVERT_NV;
else ... |
functions | void set_tex_op_nvrc(const struct wined3d_gl_info *gl_info, const struct wined3d_state *state, BOOL is_alpha,
int stage, enum wined3d_texture_op op, DWORD arg1, DWORD arg2, DWORD arg3, INT texture_idx, DWORD dst)
{
struct tex_op_args tex_op_args = {{0} |
functions | void nvrc_colorop(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
{
DWORD stage = (state_id - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
BOOL tex_used = context->fixed_function_usage_map & (1 << stage);
DWORD mapped_stage = context->tex_unit_map[stag... |
functions | void nvrc_resultarg(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
{
DWORD stage = (state_id - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
TRACE("Setting result arg for stage %u.\n", stage);
if (!isStateDirty(context, STATE_TEXTURESTAGE(stage, WINE... |
functions | void nvts_texdim(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
{
DWORD sampler = state_id - STATE_SAMPLER(0);
DWORD mapped_stage = context->tex_unit_map[sampler];
/* No need to enable / disable anything here for unused samplers. The tex_colorop
* handler takes care... |
functions | void nvts_bumpenvmat(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
{
DWORD stage = (state_id - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
DWORD mapped_stage = context->tex_unit_map[stage + 1];
const struct wined3d_gl_info *gl_info = context->gl_inf... |
functions | void nvrc_texfactor(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
float col[4];
D3DCOLORTOGLFLOAT4(state->render_states[WINED3D_RS_TEXTUREFACTOR], col);
GL_EXTCALL(glCombinerParameterfvNV(GL_CONSTANT_COLOR... |
functions | void nvrc_enable(const struct wined3d_gl_info *gl_info, BOOL enable)
{
if (enable)
{
gl_info->gl_ops.gl.p_glEnable(GL_REGISTER_COMBINERS_NV);
checkGLcall("glEnable(GL_REGISTER_COMBINERS_NV)");
} |
functions | void nvts_enable(const struct wined3d_gl_info *gl_info, BOOL enable)
{
nvrc_enable(gl_info, enable);
if (enable)
{
gl_info->gl_ops.gl.p_glEnable(GL_TEXTURE_SHADER_NV);
checkGLcall("glEnable(GL_TEXTURE_SHADER_NV)");
} |
functions | void nvrc_fragment_get_caps(const struct wined3d_gl_info *gl_info, struct fragment_caps *caps)
{
caps->wined3d_caps = 0;
caps->PrimitiveMiscCaps = WINED3DPMISCCAPS_TSSARGTEMP;
/* The caps below can be supported but aren't handled yet in utils.c
* 'd3dta_to_combiner_input', disable them until support i... |
functions | void nvrc_fragment_free(struct wined3d_device *device) {} |
functions | BOOL nvts_color_fixup_supported(struct color_fixup_desc fixup)
{
if (TRACE_ON(d3d))
{
TRACE("Checking support for fixup:\n");
dump_color_fixup_desc(fixup);
} |
includes |
#include <config.h> |
includes |
#include <assert.h> |
includes | #include <errno.h> |
includes | #include <stdlib.h> |
includes | #include <string.h> |
includes | #include <sys/socket.h> |
includes | #include <sys/types.h> |
includes | #include <sys/uio.h> |
includes | #include <sys/wait.h> |
includes | #include <unistd.h> |
structs | struct worker_request {
size_t request_len; /* Length of the payload in bytes. */
worker_request_func *request_cb; /* Function to call in worker process. */
worker_reply_func *reply_cb; /* Function to call in main process. */
void *reply_aux; /* Auxiliary data for 'reply... |
structs | struct worker_reply {
size_t reply_len; /* Length of the payload in bytes. */
worker_reply_func *reply_cb; /* Function to call in main process. */
void *reply_aux; /* Auxiliary data for 'reply_cb'. */
}; |
structs | struct rxbuf {
/* Header. */
struct ofpbuf header; /* Header data. */
int fds[SOUTIL_MAX_FDS]; /* File descriptors. */
size_t n_fds;
/* Payload. */
struct ofpbuf payload; /* Payload data. */
}; |
functions | void
worker_start(void)
{
int work_fds[2];
assert(client_sock < 0);
/* Create non-blocking socket pair. */
xsocketpair(AF_UNIX, SOCK_STREAM, 0, work_fds);
xset_nonblocking(work_fds[0]);
xset_nonblocking(work_fds[1]);
if (!fork_and_clean_up()) {
/* In child (worker) process. */
... |
functions | bool
worker_is_running(void)
{
return client_sock >= 0;
} |
functions | void
worker_run(void)
{
if (worker_is_running()) {
int error;
error = rxbuf_run(&client_rx, client_sock,
sizeof(struct worker_reply));
if (!error) {
struct worker_reply *reply = client_rx.header.data;
reply->reply_cb(&client_rx.payload, clie... |
functions | else if (error != EAGAIN) {
worker_broke();
VLOG_ABORT("receive from worker failed (%s)",
ovs_retval_to_string(error));
} |
functions | void
worker_wait(void)
{
if (worker_is_running()) {
poll_fd_wait(client_sock, POLLIN);
} |
functions | void
worker_request(const void *data, size_t size,
const int fds[], size_t n_fds,
worker_request_func *request_cb,
worker_reply_func *reply_cb, void *aux)
{
if (size > 0) {
struct iovec iov;
iov.iov_base = (void *) data;
iov.iov_len = size;
... |
functions | int
worker_send_iovec(const struct iovec iovs[], size_t n_iovs,
const int fds[], size_t n_fds)
{
size_t sent = 0;
for (;;) {
int error;
/* Try to send the rest of the request. */
error = send_iovec_and_fds_fully(client_sock, iovs, n_iovs,
... |
functions | void
worker_request_iovec(const struct iovec iovs[], size_t n_iovs,
const int fds[], size_t n_fds,
worker_request_func *request_cb,
worker_reply_func *reply_cb, void *aux)
{
struct worker_request rq;
struct iovec *all_iovs;
int error;
asser... |
functions | void
worker_broke(void)
{
if (client_sock >= 0) {
close(client_sock);
client_sock = -1;
} |
functions | void
worker_reply(const void *data, size_t size, const int fds[], size_t n_fds)
{
if (size > 0) {
struct iovec iov;
iov.iov_base = (void *) data;
iov.iov_len = size;
worker_reply_iovec(&iov, 1, fds, n_fds);
} |
functions | void
worker_reply_iovec(const struct iovec *iovs, size_t n_iovs,
const int fds[], size_t n_fds)
{
struct worker_reply reply;
struct iovec *all_iovs;
int error;
assert(expect_reply);
expect_reply = false;
reply.reply_len = iovec_len(iovs, n_iovs);
reply.reply_cb = req... |
functions | else if (error) {
VLOG_ABORT("send failed (%s)", strerror(error));
} |
functions | void
worker_main(int fd)
{
struct rxbuf rx;
server_sock = fd;
subprogram_name = "worker";
proctitle_set("%s: worker process for pid %lu",
program_name, (unsigned long int) getppid());
VLOG_INFO("worker process started");
rxbuf_init(&rx);
for (;;) {
int error;
... |
functions | else if (error == EOF && !rx.header.size) {
/* Main process closed the IPC socket. Exit cleanly. */
break;
} |
functions | else if (error != EAGAIN) {
VLOG_ABORT("RPC receive failed (%s)", strerror(error));
} |
functions | void
rxbuf_init(struct rxbuf *rx)
{
ofpbuf_init(&rx->header, 0);
rx->n_fds = 0;
ofpbuf_init(&rx->payload, 0);
} |
functions | void
rxbuf_clear(struct rxbuf *rx)
{
ofpbuf_clear(&rx->header);
rx->n_fds = 0;
ofpbuf_clear(&rx->payload);
} |
functions | int
rxbuf_run(struct rxbuf *rx, int sock, size_t header_len)
{
for (;;) {
if (!rx->header.size) {
int retval;
ofpbuf_clear(&rx->header);
ofpbuf_prealloc_tailroom(&rx->header, header_len);
retval = recv_data_and_fds(sock, rx->header.data, header_len,
... |
functions | else if (rx->header.size < header_len) {
size_t bytes_read;
int error;
error = read_fully(sock, ofpbuf_tail(&rx->header),
header_len - rx->header.size, &bytes_read);
rx->header.size += bytes_read;
if (error) {
re... |
includes |
#include <apr.h> |
includes | #include <apr_file_io.h> |
includes | #include <apr_file_info.h> |
includes | #include <apr_strings.h> |
includes | #include <string.h> |
defines |
#define _IS_SEPARATOR(_c) ((_c=='/')||(_c=='\\')) |
includes |
#include <windows.h> |
includes | #include <stdio.h> |
includes | #include <assert.h> |
defines |
#define MAX_SERIAL_DEV_PATH 128 |
functions | DEVICE_CMD Open_Serial(REBREQ *req)
{
struct devreq_serial *serial = DEVREQ_SERIAL(req);
// req->special.serial.path should be prefixed with "\\.\" to allow for
// higher com port numbers
//
WCHAR fullpath[MAX_SERIAL_DEV_PATH] = L"\\\\.\\";
assert(serial->path != NULL);
// Concatenate the... |
functions | DEVICE_CMD Close_Serial(REBREQ *req)
{
if (req->requestee.handle != NULL) {
//
// !!! Should we free req->special.serial.prior_attr termios struct?
//
CloseHandle(req->requestee.handle);
req->requestee.handle = NULL;
} |
functions | DEVICE_CMD Read_Serial(REBREQ *req)
{
assert(req->requestee.handle != NULL);
//printf("reading %d bytes\n", req->length);
DWORD result;
if (not ReadFile(
req->requestee.handle, req->common.data, req->length, &result, 0
)){
rebFail_OS (GetLastError());
} |
functions | DEVICE_CMD Write_Serial(REBREQ *req)
{
DWORD len = req->length - req->actual;
assert(req->requestee.handle != NULL);
if (len <= 0)
return DR_DONE;
DWORD result;
if (not WriteFile(
req->requestee.handle, req->common.data, len, &result, NULL
)){
rebFail_OS (GetLastError(... |
functions | DEVICE_CMD Query_Serial(REBREQ *req)
{
#ifdef QUERY_IMPLEMENTED
struct pollfd pfd;
if (req->requestee.handle) {
pfd.fd = req->requestee.handle;
pfd.events = POLLIN;
n = poll(&pfd, 1, 0);
} |
includes | #include <stdio.h> |
includes | #include <stdlib.h> |
defines |
#define MAXLINE 50 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.