Projectname large_stringclasses 15
values | Filepath large_stringlengths 4 106 ⌀ | Function large_stringlengths 11 3.45k | Label list |
|---|---|---|---|
Chromium | native_client_sdk/src/libraries/nacl_io/kernel_wrap_irt_ext.c |
static int ext_chmod(const char *pathname, mode_t mode) {
ERRNO_RTN(ki_chmod(pathname, mode));
} | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/nacl_io/kernel_wrap_irt_ext.c |
void _real_exit(int status) {
INIT_INTERFACE_ASSERT(s_irt_basic);
return s_irt_basic.interface.exit(status);
} | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/nacl_io/kernel_wrap_irt_ext.c |
int _real_fstat(int fd, struct stat *buf) {
INIT_INTERFACE_ENOSYS(s_irt_fdio);
nacl_irt_stat_t nacl_buf;
int err = s_irt_fdio.interface.fstat(fd, &nacl_buf);
if (err) {
errno = err;
return -1;
}
nacl_stat_to_stat(&nacl_buf, buf);
return 0;
} | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/nacl_io/kernel_wrap_irt_ext.c |
int _real_mmap(void **addr, size_t length, int prot, int flags, int fd,
int64_t offset) {
INIT_INTERFACE_ENOSYS(s_irt_memory);
return s_irt_memory.interface.mmap(addr, length, prot, flags, fd, offset);
} | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/nacl_io/kernel_wrap_irt_ext.c |
int _real_open_resource(const char *file, int *fd) {
INIT_INTERFACE_ENOSYS(s_irt_resource_open);
return s_irt_resource_open.interface.open_resource(file, fd);
} | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/nacl_io/kernel_wrap_irt_ext.c |
int _real_write(int fd, const void *buf, size_t count, size_t *nwrote) {
INIT_INTERFACE_ENOSYS(s_irt_fdio);
return s_irt_fdio.interface.write(fd, buf, count, nwrote);
} | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/nacl_io/kernel_wrap_irt_ext.c |
int _real_getcwd(char *pathname, size_t len) {
INIT_INTERFACE_ENOSYS(s_irt_dev_filename);
return s_irt_dev_filename.interface.getcwd(pathname, len);
} | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/nacl_io/log.c | void nacl_io_log(const char *format, ...) {
va_list args;
size_t wrote;
char *output;
#ifdef _MSC_VER
/* TODO(sbc): vsnprintf on win32 does not return the
* size of the buffer needed. This can be implemented
* on win32 in terms of _vscprintf; */
#error "not implemented for win32"
#endif
va_start(args... | [
1,
1
] |
Chromium | native_client_sdk/src/libraries/nacl_io/syscalls/socket/bind.c |
int bind(int fd, const struct sockaddr *addr, socklen_t len) {
return ki_bind(fd, addr, len);
} | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/nacl_io/syscalls/socket/freeaddrinfo.c |
void freeaddrinfo(struct addrinfo *res) { ki_freeaddrinfo(res); } | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/nacl_io/syscalls/socket/gai_strerror.c | const
#endif
char *
gai_strerror(int errcode) {
switch (errcode) {
case EAI_BADFLAGS:
return "Invalid value for `ai_flags' field.";
case EAI_NONAME:
return "NAME or SERVICE is unknown.";
case EAI_AGAIN:
return "Temporary failure in name resolution.";
case EAI_FAIL:
return "Non-recovera... | [
1,
0
] |
Chromium | native_client_sdk/src/libraries/nacl_io/syscalls/socket/herror.c |
void herror(const char *s) {
if (s) {
fprintf(stderr, "%s: ", s);
}
fprintf(stderr, "%s\n", hstrerror(h_errno));
} | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/nacl_io/syscalls/socket/htons.c |
inline uint16_t htons(uint16_t hostshort) {
uint8_t result_bytes[2];
result_bytes[0] = (uint8_t)((hostshort >> 8) & 0xFF);
result_bytes[1] = (uint8_t)(hostshort & 0xFF);
uint16_t result;
memcpy(&result, result_bytes, 2);
return result;
} | [
1,
0
] |
Chromium | native_client_sdk/src/libraries/nacl_io/syscalls/socket/inet_pton.c |
int inet_pton(int af, const char *src, void *dst) {
if (!src || !dst) {
return 0;
}
if (af == AF_INET) {
return inet_pton_v4(src, dst);
} else if (af == AF_INET6) {
return inet_pton_v6(src, dst);
}
errno = EAFNOSUPPORT;
return -1;
} | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/nacl_io/syscalls/socket/recvfrom.c |
ssize_t recvfrom(int fd, void *buf, size_t len, int flags,
struct sockaddr *addr, socklen_t *addrlen) {
return ki_recvfrom(fd, buf, len, flags, addr, addrlen);
} | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/nacl_io/syscalls/socket/recvmsg.c |
ssize_t recvmsg(int fd, struct msghdr *msg, int flags) {
return ki_recvmsg(fd, msg, flags);
} | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/nacl_io/syscalls/socket/socketpair.c |
int socketpair(int domain, int type, int protocol, int *sv) {
return ki_socketpair(domain, type, protocol, sv);
} | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/nacl_io/syscalls/symlink.c |
int symlink(const char *oldpath, const char *newpath) {
return ki_symlink(oldpath, newpath);
} | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/nacl_io/syscalls/termios/cfgetispeed.c | speed_t cfgetispeed(const struct termios *termios_p) {
return termios_p->c_ispeed;
}
#endif | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/nacl_io/syscalls/termios/cfgetospeed.c | speed_t cfgetospeed(const struct termios *termios_p) {
return termios_p->c_ospeed;
}
#endif | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/nacl_io/syscalls/termios/cfsetispeed.c | int cfsetispeed(struct termios *termios_p, speed_t speed) {
termios_p->c_ispeed = speed;
return 0;
}
#endif | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/nacl_io/syscalls/termios/cfsetospeed.c | int cfsetospeed(struct termios *termios_p, speed_t speed) {
termios_p->c_ospeed = speed;
return 0;
}
#endif | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/nacl_io/syscalls/termios/tcflow.c |
int tcflow(int fd, int action) {
errno = ENOSYS;
return -1;
}
#endif | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/nacl_io/syscalls/termios/tcflush.c |
int tcflush(int fd, int queue_selector) {
return ki_tcflush(fd, queue_selector);
}
#endif | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/nacl_io/syscalls/uname.c | int uname(struct utsname *buf) {
memset(buf, 0, sizeof(struct utsname));
snprintf(buf->sysname, _UTSNAME_LENGTH, "NaCl");
/* TODO(sbc): Fill out the other fields with useful information. */
return 0;
} | [
1,
1
] |
Chromium | native_client_sdk/src/libraries/nacl_io/syscalls/utime.c |
int utime(const char *filename, const struct utimbuf *times) {
return ki_utime(filename, times);
} | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/ppapi_simple/ps_context_2d.c |
void PSContext2DFree(PSContext2D_t *ctx) {
if (ctx->graphic_2d) {
PSInterfaceCore()->ReleaseResource(ctx->graphic_2d);
ctx->graphic_2d = 0;
}
if (ctx->image) {
PSInterfaceCore()->ReleaseResource(ctx->image);
ctx->image = 0;
}
free(ctx);
} | [
1,
0
] |
Chromium | native_client_sdk/src/libraries/ppapi_simple/ps_context_2d.c | int PSContext2DGetBuffer(PSContext2D_t *ctx) {
if (!ctx->bound)
return 0;
if (ctx->image)
return 1;
struct PP_Size size;
size.width = ctx->width;
size.height = ctx->height;
// Allocate a new image resource with the specified size and format, but
// do not ZERO out the buffer first since we will... | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/ppapi_simple/ps_entrypoints_c.c |
int32_t PPP_InitializeModule(PP_Module module, PPB_GetInterface get_interface) {
g_ps_get_interface = get_interface;
PSInterfaceInit();
return PP_OK;
} | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/ppapi_simple/ps_event.c |
static void EnqueueEvent(struct PSEvent *event) {
pthread_mutex_lock(&s_lock);
if (!s_event_tail) {
s_event_head = s_event_tail = event;
event->next = NULL;
} else {
s_event_tail->next = event;
s_event_tail = event;
}
pthread_cond_signal(&s_cond);
pthread_mutex_unlock(&s_lock);
} | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/ppapi_simple/ps_event.c |
void PSEventRelease(struct PSEvent *event) {
if (event) {
switch (event->type) {
case PSE_INSTANCE_HANDLEMESSAGE:
PSInterfaceVar()->Release(event->as_var);
break;
case PSE_INSTANCE_HANDLEINPUT:
case PSE_INSTANCE_DIDCHANGEVIEW:
if (event->as_resource) {
PSInterfaceCore()->Rel... | [
1,
0
] |
Chromium | native_client_sdk/src/libraries/ppapi_simple/ps_event.c | void PSEventPostVar(PSEventType type, struct PP_Var var) {
assert(PSE_INSTANCE_HANDLEMESSAGE == type);
if (var.type == PP_VARTYPE_DICTIONARY) {
struct PP_Var keys_var = PSInterfaceVarDictionary()->GetKeys(var);
if (PSInterfaceVarArray()->GetLength(keys_var) == 1) {
struct PP_Var key_var = PSInterface... | [
1,
0
] |
Chromium | native_client_sdk/src/libraries/ppapi_simple/ps_event.c |
void PSEventPostResource(PSEventType type, PP_Resource resource) {
assert(PSE_INSTANCE_HANDLEINPUT == type ||
PSE_INSTANCE_DIDCHANGEVIEW == type);
if (resource) {
PSInterfaceCore()->AddRefResource(resource);
}
struct PSEvent *event = malloc(sizeof(struct PSEvent));
memset(event, 0, sizeof(*even... | [
1,
0
] |
Chromium | native_client_sdk/src/libraries/ppapi_simple/ps_instance.c |
static PP_Bool InputEvent_HandleInputEvent(PP_Instance instance,
PP_Resource input_event) {
PSEventPostResource(PSE_INSTANCE_HANDLEINPUT, input_event);
return PP_TRUE;
} | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/ppapi_simple/ps_instance.c |
void PSInstanceSetVerbosity(enum PSVerbosity verbosity) {
s_verbosity = verbosity;
} | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/ppapi_simple/ps_instance.c |
const void *PSGetInterfaceImplementation(const char *interface_name) {
if (strcmp(interface_name, PPP_INSTANCE_INTERFACE_1_1) == 0) {
static struct PPP_Instance_1_1 interface = {
&Instance_DidCreate, &Instance_DidDestroy,
&Instance_DidChangeView, &Instance_DidChangeFocus,
&I... | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/autostatic.c |
static int on_process_exit(void) {
pthread_win32_thread_detach_np();
pthread_win32_process_detach_np();
return 0;
}
#if defined(__MINGW64__) || defined(__MINGW32__) | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/cleanup.c | ptw32_cleanup_t *ptw32_pop_cleanup(int execute)
{
ptw32_cleanup_t *cleanup;
cleanup = (ptw32_cleanup_t *)pthread_getspecific(ptw32_cleanupKey);
if (cleanup != NULL) {
if (execute && (cleanup->routine != NULL)) {
(*cleanup->routine)(cleanup->arg);
}
pthread_setspecific(ptw32_cleanupKey, (voi... | [
1,
0
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/errno.c | int *_errno(void) {
pthread_t self;
int *result;
if ((self = pthread_self()).p == NULL) {
result = &reallyBad;
} else {
result = (int *)(&self.p->exitStatus);
}
return (result);
} /* _errno */
#endif /* (NEED_ERRNO) */ | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/pthread_attr_destroy.c | int pthread_attr_destroy(pthread_attr_t *attr)
{
if (ptw32_is_attr(attr) != 0) {
return EINVAL;
}
/*
* Set the attribute object to a specific invalid value.
*/
(*attr)->valid = 0;
free(*attr);
*attr = NULL;
return 0;
} | [
1,
0
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/pthread_attr_getdetachstate.c | int pthread_attr_getdetachstate(const pthread_attr_t *attr, int *detachstate)
{
if (ptw32_is_attr(attr) != 0 || detachstate == NULL) {
return EINVAL;
}
*detachstate = (*attr)->detachstate;
return 0;
} | [
1,
0
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/pthread_attr_getinheritsched.c |
int pthread_attr_getinheritsched(const pthread_attr_t *attr,
int *inheritsched) {
if (ptw32_is_attr(attr) != 0 || inheritsched == NULL) {
return EINVAL;
}
*inheritsched = (*attr)->inheritsched;
return 0;
} | [
1,
0
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/pthread_attr_init.c | int pthread_attr_init(pthread_attr_t *attr)
{
pthread_attr_t attr_result;
if (attr == NULL) {
/* This is disallowed. */
return EINVAL;
}
attr_result = (pthread_attr_t)malloc(sizeof(*attr_result));
if (attr_result == NULL) {
return ENOMEM;
}
#if defined(_POSIX_THREAD_ATTR_STACKSIZE)
/*
... | [
1,
1
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/pthread_attr_setdetachstate.c | int pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate)
{
if (ptw32_is_attr(attr) != 0) {
return EINVAL;
}
if (detachstate != PTHREAD_CREATE_JOINABLE &&
detachstate != PTHREAD_CREATE_DETACHED) {
return EINVAL;
}
(*attr)->detachstate = detachstate;
return 0;
} | [
1,
0
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/pthread_attr_setinheritsched.c |
int pthread_attr_setinheritsched(pthread_attr_t *attr, int inheritsched) {
if (ptw32_is_attr(attr) != 0) {
return EINVAL;
}
if (PTHREAD_INHERIT_SCHED != inheritsched &&
PTHREAD_EXPLICIT_SCHED != inheritsched) {
return EINVAL;
}
(*attr)->inheritsched = inheritsched;
return 0;
} | [
1,
0
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/pthread_attr_setschedpolicy.c |
int pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy) {
if (ptw32_is_attr(attr) != 0) {
return EINVAL;
}
if (policy != SCHED_OTHER) {
return ENOTSUP;
}
return 0;
} | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/pthread_attr_setstackaddr.c | int pthread_attr_setstackaddr(pthread_attr_t *attr, void *stackaddr)
{
#if defined(_POSIX_THREAD_ATTR_STACKADDR)
if (ptw32_is_attr(attr) != 0) {
return EINVAL;
}
(*attr)->stackaddr = stackaddr;
return 0;
#else
return ENOSYS;
#endif /* _POSIX_THREAD_ATTR_STACKADDR */
} | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/pthread_barrierattr_init.c | int pthread_barrierattr_init(pthread_barrierattr_t *attr)
{
pthread_barrierattr_t ba;
int result = 0;
ba = (pthread_barrierattr_t)calloc(1, sizeof(*ba));
if (ba == NULL) {
result = ENOMEM;
} else {
ba->pshared = PTHREAD_PROCESS_PRIVATE;
}
*attr = ba;
return (result);
} | [
1,
0
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/pthread_barrierattr_setpshared.c | int pthread_barrierattr_setpshared(pthread_barrierattr_t *attr, int pshared)
{
int result;
if ((attr != NULL && *attr != NULL) &&
((pshared == PTHREAD_PROCESS_SHARED) ||
(pshared == PTHREAD_PROCESS_PRIVATE))) {
if (pshared == PTHREAD_PROCESS_SHARED) {
#if !defined(_POSIX_THREAD_PROCESS_SHARED)
... | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/pthread_barrier_destroy.c | int pthread_barrier_destroy(pthread_barrier_t *barrier) {
int result = 0;
pthread_barrier_t b;
ptw32_mcs_local_node_t node;
if (barrier == NULL || *barrier == (pthread_barrier_t)PTW32_OBJECT_INVALID) {
return EINVAL;
}
if (0 != ptw32_mcs_lock_try_acquire(&(*barrier)->lock, &node)) {
return EBUSY;
... | [
1,
1
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/pthread_cancel.c | static void ptw32_cancel_self(void) { ptw32_throw(PTW32_EPS_CANCEL); } | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/pthread_cancel.c | DWORD
ptw32_RegisterCancelation(PAPCFUNC unused1, HANDLE threadH, DWORD unused2) {
CONTEXT context;
context.ContextFlags = CONTEXT_CONTROL;
GetThreadContext(threadH, &context);
PTW32_PROGCTR(context) = (DWORD_PTR)ptw32_cancel_self;
SetThreadContext(threadH, &context);
return 0;
} | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/pthread_condattr_destroy.c | int pthread_condattr_destroy(pthread_condattr_t *attr)
{
int result = 0;
if (attr == NULL || *attr == NULL) {
result = EINVAL;
} else {
(void)free(*attr);
*attr = NULL;
result = 0;
}
return result;
} | [
1,
0
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/pthread_condattr_getpshared.c | int pthread_condattr_getpshared(const pthread_condattr_t *attr, int *pshared)
{
int result;
if ((attr != NULL && *attr != NULL) && (pshared != NULL)) {
*pshared = (*attr)->pshared;
result = 0;
} else {
result = EINVAL;
}
return result;
} | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/pthread_condattr_setpshared.c | int pthread_condattr_setpshared(pthread_condattr_t *attr, int pshared)
{
int result;
if ((attr != NULL && *attr != NULL) &&
((pshared == PTHREAD_PROCESS_SHARED) ||
(pshared == PTHREAD_PROCESS_PRIVATE))) {
if (pshared == PTHREAD_PROCESS_SHARED) {
#if !defined(_POSIX_THREAD_PROCESS_SHARED)
r... | [
1,
0
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/pthread_cond_signal.c | int pthread_cond_broadcast(pthread_cond_t *cond)
{
/*
* The TRUE unblockAll arg means unblock ALL waiters.
*/
return (ptw32_cond_unblock(cond, PTW32_TRUE));
} | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/pthread_equal.c | int pthread_equal(pthread_t t1, pthread_t t2)
{
int result;
/*
* We also accept NULL == NULL - treating NULL as a thread
* for this special case, because there is no error that we can return.
*/
result = (t1.p == t2.p && t1.x == t2.x);
return (result);
} | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/pthread_key_create.c | int pthread_key_create(pthread_key_t *key,
void(PTW32_CDECL *destructor)(void *))
{
int result = 0;
pthread_key_t newkey;
if ((newkey = (pthread_key_t)calloc(1, sizeof(*newkey))) == NULL) {
result = ENOMEM;
} else if ((newkey->key = TlsAlloc()) == TLS_OUT_OF_INDEXES) {
result = ... | [
1,
0
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/pthread_kill.c | int pthread_kill(pthread_t thread, int sig)
{
int result = 0;
ptw32_thread_t *tp;
ptw32_mcs_local_node_t node;
ptw32_mcs_lock_acquire(&ptw32_thread_reuse_lock, &node);
tp = (ptw32_thread_t *)thread.p;
if (NULL == tp || thread.x != tp->ptHandle.x || NULL == tp->threadH) {
result = ESRCH;
}
ptw32... | [
1,
0
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/pthread_mutexattr_getrobust.c | int pthread_mutexattr_getrobust(const pthread_mutexattr_t *attr, int *robust)
{
int result = EINVAL;
if ((attr != NULL && *attr != NULL && robust != NULL)) {
*robust = (*attr)->robustness;
result = 0;
}
return (result);
} | [
1,
0
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/pthread_mutexattr_gettype.c |
int pthread_mutexattr_gettype(const pthread_mutexattr_t *attr, int *kind) {
int result = 0;
if (attr != NULL && *attr != NULL && kind != NULL) {
*kind = (*attr)->kind;
} else {
result = EINVAL;
}
return (result);
} | [
1,
0
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/pthread_mutexattr_setkind_np.c |
int pthread_mutexattr_setkind_np(pthread_mutexattr_t *attr, int kind) {
return pthread_mutexattr_settype(attr, kind);
} | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/pthread_mutex_consistent.c | INLINE
int ptw32_robust_mutex_inherit(pthread_mutex_t *mutex) {
int result;
pthread_mutex_t mx = *mutex;
ptw32_robust_node_t *robust = mx->robustNode;
switch ((LONG)PTW32_INTERLOCKED_COMPARE_EXCHANGE_LONG(
(PTW32_INTERLOCKED_LONGPTR)&robust->stateInconsistent,
(PTW32_INTERLOCKED_LONG)PTW32_ROBUST_I... | [
1,
0
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/pthread_mutex_consistent.c | int pthread_mutex_consistent(pthread_mutex_t *mutex) {
pthread_mutex_t mx = *mutex;
int result = 0;
if (mx == NULL) {
return EINVAL;
}
if (mx->kind >= 0 ||
(PTW32_INTERLOCKED_LONG)PTW32_ROBUST_INCONSISTENT !=
PTW32_INTERLOCKED_COMPARE_EXCHANGE_LONG(
(PTW32_INTERLOCKED_LONGP... | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/pthread_num_processors_np.c | int pthread_num_processors_np(void) {
int count;
if (ptw32_getprocessors(&count) != 0) {
count = 1;
}
return (count);
} | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/pthread_once.c | int pthread_once(pthread_once_t *once_control,
void(PTW32_CDECL *init_routine)(void)) {
if (once_control == NULL || init_routine == NULL) {
return EINVAL;
}
if ((PTW32_INTERLOCKED_LONG)PTW32_FALSE ==
(PTW32_INTERLOCKED_LONG)PTW32_INTERLOCKED_EXCHANGE_ADD_LONG(
(PTW32_INTERLOC... | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/pthread_rwlockattr_destroy.c | int pthread_rwlockattr_destroy(pthread_rwlockattr_t *attr)
{
int result = 0;
if (attr == NULL || *attr == NULL) {
result = EINVAL;
} else {
pthread_rwlockattr_t rwa = *attr;
*attr = NULL;
free(rwa);
}
return (result);
} | [
1,
0
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/pthread_rwlockattr_getpshared.c | int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *attr,
int *pshared)
{
int result;
if ((attr != NULL && *attr != NULL) && (pshared != NULL)) {
*pshared = (*attr)->pshared;
result = 0;
} else {
result = EINVAL;
}
return (result);
} | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/pthread_rwlock_init.c | int pthread_rwlock_init(pthread_rwlock_t *rwlock,
const pthread_rwlockattr_t *attr) {
int result;
pthread_rwlock_t rwl = 0;
if (rwlock == NULL) {
return EINVAL;
}
if (attr != NULL && *attr != NULL) {
result = EINVAL;
goto DONE;
}
rwl = (pthread_rwlock_t)calloc(1, siz... | [
1,
0
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/pthread_rwlock_rdlock.c | int pthread_rwlock_rdlock(pthread_rwlock_t *rwlock) {
int result;
pthread_rwlock_t rwl;
if (rwlock == NULL || *rwlock == NULL) {
return EINVAL;
}
if (*rwlock == PTHREAD_RWLOCK_INITIALIZER) {
result = ptw32_rwlock_check_need_init(rwlock);
if (result != 0 && result != EBUSY) {
return result... | [
1,
0
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/pthread_rwlock_timedrdlock.c | int pthread_rwlock_timedrdlock(pthread_rwlock_t *rwlock,
const struct timespec *abstime) {
int result;
pthread_rwlock_t rwl;
if (rwlock == NULL || *rwlock == NULL) {
return EINVAL;
}
if (*rwlock == PTHREAD_RWLOCK_INITIALIZER) {
result = ptw32_rwlock_check_need_init(rwl... | [
1,
0
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/pthread_rwlock_trywrlock.c | int pthread_rwlock_trywrlock(pthread_rwlock_t *rwlock) {
int result, result1;
pthread_rwlock_t rwl;
if (rwlock == NULL || *rwlock == NULL) {
return EINVAL;
}
if (*rwlock == PTHREAD_RWLOCK_INITIALIZER) {
result = ptw32_rwlock_check_need_init(rwlock);
if (result != 0 && result != EBUSY) {
r... | [
1,
0
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/pthread_setschedparam.c | int pthread_setschedparam(pthread_t thread, int policy,
const struct sched_param *param) {
int result;
result = pthread_kill(thread, 0);
if (0 != result) {
return result;
}
/* Validate the scheduling policy. */
if (policy < SCHED_MIN || policy > SCHED_MAX) {
return EINVAL... | [
1,
0
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/pthread_spin_unlock.c |
int pthread_spin_unlock(pthread_spinlock_t *lock) {
register pthread_spinlock_t s;
if (NULL == lock || NULL == *lock) {
return (EINVAL);
}
s = *lock;
if (s == PTHREAD_SPINLOCK_INITIALIZER) {
return EPERM;
}
switch ((long)PTW32_INTERLOCKED_COMPARE_EXCHANGE_LONG(
(PTW32_INTERLOCKED_LONGP... | [
1,
0
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/pthread_timechange_handler_np.c | void *pthread_timechange_handler_np(void *arg)
{
int result = 0;
pthread_cond_t cv;
ptw32_mcs_local_node_t node;
ptw32_mcs_lock_acquire(&ptw32_cond_list_lock, &node);
cv = ptw32_cond_list_head;
while (cv != NULL && 0 == result) {
result = pthread_cond_broadcast(&cv);
cv = cv->next;
}
ptw32_... | [
1,
0
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/pthread_win32_attach_detach_np.c |
BOOL pthread_win32_test_features_np(int feature_mask) {
return ((ptw32_features & feature_mask) == feature_mask);
} | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/ptw32_cond_check_need_init.c | INLINE int ptw32_cond_check_need_init(pthread_cond_t *cond) {
int result = 0;
ptw32_mcs_local_node_t node;
ptw32_mcs_lock_acquire(&ptw32_cond_test_init_lock, &node);
/*
* We got here possibly under race
* conditions. Check again inside the critical section.
* If a static cv has been destroyed, the ap... | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/ptw32_semwait.c | int ptw32_semwait(sem_t *sem)
{
int result = 0;
sem_t s = *sem;
if (s == NULL) {
result = EINVAL;
} else {
if ((result = pthread_mutex_lock(&s->lock)) == 0) {
int v;
/* See sem_destroy.c
*/
if (*sem == NULL) {
(void)pthread_mutex_unlock(&s->lock);
errno = EINV... | [
1,
0
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/ptw32_spinlock_check_need_init.c | INLINE int ptw32_spinlock_check_need_init(pthread_spinlock_t *lock) {
int result = 0;
ptw32_mcs_local_node_t node;
ptw32_mcs_lock_acquire(&ptw32_spinlock_test_init_lock, &node);
/*
* We got here possibly under race
* conditions. Check again inside the critical section
* and only initialise if the spi... | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/ptw32_throw.c |
void ptw32_pop_cleanup_all(int execute) {
while (NULL != ptw32_pop_cleanup(execute)) {
}
} | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/ptw32_tkAssocCreate.c | int ptw32_tkAssocCreate(ptw32_thread_t *sp, pthread_key_t key)
{
ThreadKeyAssoc *assoc;
/*
* Have to create an association and add it
* to both the key and the thread.
*
* Both key->keyLock and thread->threadLock are locked before
* entry to this routine.
*/
assoc = (ThreadKeyAssoc *)calloc(1,... | [
1,
0
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/sched_get_priority_min.c | int sched_get_priority_min(int policy) {
if (policy < SCHED_MIN || policy > SCHED_MAX) {
errno = EINVAL;
return -1;
}
#if (THREAD_PRIORITY_LOWEST > THREAD_PRIORITY_NORMAL)
return PTW32_MIN(THREAD_PRIORITY_IDLE, THREAD_PRIORITY_TIME_CRITICAL);
#else
/* This is independent of scheduling policy in Win32.... | [
1,
0
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/sem_getvalue.c | int sem_getvalue(sem_t *sem, int *sval)
{
if (sem == NULL || *sem == NULL || sval == NULL) {
errno = EINVAL;
return -1;
} else {
long value;
register sem_t s = *sem;
int result = 0;
if ((result = pthread_mutex_lock(&s->lock)) == 0) {
/* See sem_destroy.c
*/
if (*sem == N... | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/sem_timedwait.c | int sem_timedwait(sem_t *sem, const struct timespec *abstime)
{
int result = 0;
sem_t s = *sem;
pthread_testcancel();
if (sem == NULL) {
result = EINVAL;
} else {
DWORD milliseconds;
if (abstime == NULL) {
milliseconds = INFINITE;
} else {
/*
* Calculate timeout as milli... | [
1,
0
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/sem_wait.c | int sem_wait(sem_t *sem)
{
int result = 0;
sem_t s = *sem;
pthread_testcancel();
if (s == NULL) {
result = EINVAL;
} else {
if ((result = pthread_mutex_lock(&s->lock)) == 0) {
int v;
/* See sem_destroy.c
*/
if (*sem == NULL) {
(void)pthread_mutex_unlock(&s->lock);
... | [
1,
0
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/signal.c |
static void ptw32_signal_thread() {} | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/signal.c |
static void ptw32_signal_callhandler() {} | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/third_party/pthreads-win32/signal.c | int pthread_sigmask(int how, sigset_t const *set, sigset_t *oset) {
pthread_t thread = pthread_self();
if (thread.p == NULL) {
return ENOENT;
}
if (set != NULL) {
switch (how) {
case SIG_BLOCK:
break;
case SIG_UNBLOCK:
break;
case SIG_SETMASK:
break;
default:
/*... | [
1,
1
] |
Chromium | native_client_sdk/src/libraries/xray/demangle.c |
const char *XRayDemangle(char *demangle, size_t size, const char *symbol) {
#if !defined(XRAY_NO_DEMANGLE)
int stat;
__cxa_demangle(symbol, demangle, &size, &stat);
if (stat == 0)
return demangle;
#endif
return symbol;
} | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/xray/hashtable.c |
int XRayHashTableGetCapacity(struct XRayHashTable *table) {
return table->capacity;
} | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/xray/hashtable.c | void *XRayHashTableInsert(struct XRayHashTable *table, void *data,
uint32_t key) {
uint32_t h = XRayHashTableHashKey(key);
uint32_t m = table->capacity - 1;
uint32_t j = h & m;
uint32_t i;
for (i = 0; i < m; ++i) {
/* (the key,data isn't already in the table) */
if (NULL == ... | [
1,
0
] |
Chromium | native_client_sdk/src/libraries/xray/parsesymbols.c |
void XRaySymbolTableParseMapfile(struct XRaySymbolTable *symtab,
const char *mapfile) {
FILE *f;
char line[XRAY_LINE_SIZE];
bool in_text = false;
bool in_link_once = false;
int in_link_once_counter = 0;
int num_symbols = 0;
printf("XRay: opening mapfile %s\n", mapfile);... | [
1,
0
] |
Chromium | native_client_sdk/src/libraries/xray/report.c | void XRayReport(struct XRayTraceCapture *capture, FILE *f, float percent_cutoff,
int ticks_cutoff) {
int head = XRayFrameGetHead(capture);
int frame = XRayFrameGetTail(capture);
int counter = 0;
XRayFrameReport(capture, f);
fprintf(f, "\n");
while (frame != head) {
char label[XRAY_MAX_LA... | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/xray/report.c | void XRaySaveReport(struct XRayTraceCapture *capture, const char *filename,
float percent_cutoff, int ticks_cutoff) {
FILE *f;
f = fopen(filename, "wt");
if (NULL != f) {
XRayReport(capture, f, percent_cutoff, ticks_cutoff);
fclose(f);
}
} | [
1,
0
] |
Chromium | native_client_sdk/src/libraries/xray/stringpool.c |
static int XRayStringPoolCurrentNodeSpaceAvail(struct XRayStringPool *pool) {
int i = pool->index;
return (XRAY_STRING_POOL_NODE_SIZE - i) - 1;
} | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/xray/stringpool.c | char *XRayStringPoolAppend(struct XRayStringPool *pool, const char *src) {
/* Add +1 to strnlen result to account for string termination */
int n = strnlen(src, XRAY_STRING_POOL_NODE_SIZE + 1) + 1;
int a = XRayStringPoolCurrentNodeSpaceAvail(pool);
char *dst;
/* Don't accept strings larger than the pool node... | [
1,
0
] |
Chromium | native_client_sdk/src/libraries/xray/symtable.c |
struct XRaySymbol *XRaySymbolPoolAlloc(struct XRaySymbolPool *sympool) {
struct XRaySymbol *symbol;
if (sympool->index >= XRAY_SYMBOL_POOL_NODE_SIZE) {
struct XRaySymbolPoolNode *new_pool;
new_pool = (struct XRaySymbolPoolNode *)XRayMalloc(sizeof(*new_pool));
sympool->current->next = new_pool;
sym... | [
1,
0
] |
Chromium | native_client_sdk/src/libraries/xray/symtable.c |
struct XRaySymbolPool *XRaySymbolPoolCreate() {
struct XRaySymbolPool *sympool;
struct XRaySymbolPoolNode *node;
sympool = (struct XRaySymbolPool *)XRayMalloc(sizeof(*sympool));
node = (struct XRaySymbolPoolNode *)XRayMalloc(sizeof(*node));
sympool->head = node;
sympool->current = node;
sympool->index =... | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/xray/xray.c | uint64_t RDTSC64() {
uint64_t a, d;
__asm__ __volatile__("rdtsc" : "=a"(a), "=d"(d));
return ((uint64_t)a) | (((uint64_t)d) << 32);
}
#define GTSC(_x) _x = RDTSC64() | [
0,
0
] |
Chromium | native_client_sdk/src/libraries/xray/xray.c | bool XRayTraceIsAnnotation(struct XRayTraceCapture *capture, int index) {
struct XRayTraceBufferEntry *be = &capture->buffer[index];
char *dst = (char *)be;
return 0 == *dst;
} | [
0,
0
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.