type
stringclasses
5 values
content
stringlengths
9
163k
functions
void PyErr_WriteUnraisable(PyObject *obj) { printf("Unraisable Exception\n"); // PyObject *f, *t, *v, *tb; // PyErr_Fetch(&t, &v, &tb); // f = PySys_GetObject("stderr"); // if (f != NULL) { // PyFile_WriteString("Exception ", f); // if (t) { // PyFile_WriteObject(t, f, Py_PRINT_RAW); // if (v && v != Py_None) { // PyFile_WriteString(": ", f); // PyFile_WriteObject(v, f, 0); // }
functions
int PyErr_Warn(PyObject *category, char *message) { PyObject *dict, *func = NULL; PyObject *warnings_module = PyModule_GetWarningsModule(); if (warnings_module != NULL) { dict = PyModule_GetDict(warnings_module); func = PyDict_GetItemString(dict, "warn"); }
includes
#include <include/lifecycle.h>
functions
void echo(lifecycle_Foo this, char* hook) { corto_state s = corto_stateof(this); char *stateStr = corto_ptr_str(&s, corto_state_o, 0); corto_info("callback: %s [%s]", hook, stateStr); free(stateStr); }
functions
int16_t lifecycle_Foo_construct( lifecycle_Foo this) { echo(this, "construct"); return 0; }
functions
void lifecycle_Foo_define( lifecycle_Foo this) { echo(this, "define"); }
functions
void lifecycle_Foo_deinit( lifecycle_Foo this) { echo(this, "deinit"); }
functions
void lifecycle_Foo_delete( lifecycle_Foo this) { echo(this, "delete"); }
functions
void lifecycle_Foo_destruct( lifecycle_Foo this) { echo(this, "destruct"); }
functions
int16_t lifecycle_Foo_init( lifecycle_Foo this) { echo(this, "init"); return 0; }
functions
void lifecycle_Foo_update( lifecycle_Foo this) { echo(this, "update"); }
functions
int16_t lifecycle_Foo_validate( lifecycle_Foo this) { echo(this, "validate"); return 0; }
functions
ICACHE_FLASH_ATTR coap_dumpHeader(coap_header_t *hdr) { shell_printf("Header:\n"); shell_printf(" ver 0x%02X\n", hdr->ver); shell_printf(" t 0x%02X\n", hdr->t); shell_printf(" tkl 0x%02X\n", hdr->tkl); shell_printf(" code 0x%02X\n", hdr->code); shell_printf(" id 0x%02X%02X\n", hdr->id[0], hdr->id[1]); }
functions
ICACHE_FLASH_ATTR coap_dump(const uint8_t *buf, size_t buflen, bool bare) { if (bare) { while(buflen--) shell_printf("%02X%s", *buf++, (buflen > 0) ? " " : ""); }
functions
ICACHE_FLASH_ATTR coap_parseHeader(coap_header_t *hdr, const uint8_t *buf, size_t buflen) { if (buflen < 4) return COAP_ERR_HEADER_TOO_SHORT; hdr->ver = (buf[0] & 0xC0) >> 6; if (hdr->ver != 1) return COAP_ERR_VERSION_NOT_1; hdr->t = (buf[0] & 0x30) >> 4; hdr->tkl = buf[0] & 0x0F; hdr->code = buf[1]; hdr->id[0] = buf[2]; hdr->id[1] = buf[3]; return 0; }
functions
ICACHE_FLASH_ATTR coap_parseToken(coap_buffer_t *tokbuf, const coap_header_t *hdr, const uint8_t *buf, size_t buflen) { if (hdr->tkl == 0) { tokbuf->p = NULL; tokbuf->len = 0; return 0; }
functions
else if (hdr->tkl <= 8) { if (4U + hdr->tkl > buflen) return COAP_ERR_TOKEN_TOO_SHORT; // tok bigger than packet tokbuf->p = buf+4; // past header tokbuf->len = hdr->tkl; return 0; }
functions
ICACHE_FLASH_ATTR coap_parseOption(coap_option_t *option, uint16_t *running_delta, const uint8_t **buf, size_t buflen) { const uint8_t *p = *buf; uint8_t headlen = 1; uint16_t len, delta; if (buflen < headlen) // too small return COAP_ERR_OPTION_TOO_SHORT_FOR_HEADER; delta = (p[0] & 0xF0) >> 4; len = p[0] & 0x0F; // These are untested and may be buggy if (delta == 13) { headlen++; if (buflen < headlen) return COAP_ERR_OPTION_TOO_SHORT_FOR_HEADER; delta = p[1] + 13; p++; }
functions
else if (delta == 14) { headlen += 2; if (buflen < headlen) return COAP_ERR_OPTION_TOO_SHORT_FOR_HEADER; delta = ((p[1] << 8) | p[2]) + 269; p+=2; }
functions
else if (len == 14) { headlen += 2; if (buflen < headlen) return COAP_ERR_OPTION_TOO_SHORT_FOR_HEADER; len = ((p[1] << 8) | p[2]) + 269; p+=2; }
functions
ICACHE_FLASH_ATTR coap_parseOptionsAndPayload(coap_option_t *options, uint8_t *numOptions, coap_buffer_t *payload, const coap_header_t *hdr, const uint8_t *buf, size_t buflen) { size_t optionIndex = 0; uint16_t delta = 0; const uint8_t *p = buf + 4 + hdr->tkl; const uint8_t *end = buf + buflen; int rc; if (p > end) return COAP_ERR_OPTION_OVERRUNS_PACKET; // out of bounds //coap_dump(p, end - p); // 0xFF is payload marker while((optionIndex < *numOptions) && (p < end) && (*p != 0xFF)) { if (0 != (rc = coap_parseOption(&options[optionIndex], &delta, &p, end-p))) return rc; optionIndex++; }
functions
ICACHE_FLASH_ATTR coap_dumpOptions(coap_option_t *opts, size_t numopt) { size_t i; shell_printf("Options:\n"); for (i=0;i<numopt;i++) { shell_printf(" 0x%02X [ ", opts[i].num); coap_dump(opts[i].buf.p, opts[i].buf.len, true); shell_printf(" ]\n"); }
functions
ICACHE_FLASH_ATTR coap_dumpPacket(coap_packet_t *pkt) { coap_dumpHeader(&pkt->hdr); coap_dumpOptions(pkt->opts, pkt->numopts); shell_printf("Payload: \n"); coap_dump(pkt->payload.p, pkt->payload.len, true); shell_printf("\n"); }
functions
ICACHE_FLASH_ATTR coap_parse(coap_packet_t *pkt, const uint8_t *buf, size_t buflen) { int rc; // coap_dump(buf, buflen, false); if (0 != (rc = coap_parseHeader(&pkt->hdr, buf, buflen))) return rc; // coap_dumpHeader(&hdr); if (0 != (rc = coap_parseToken(&pkt->tok, &pkt->hdr, buf, buflen))) return rc; pkt->numopts = MAXOPT; if (0 != (rc = coap_parseOptionsAndPayload(pkt->opts, &(pkt->numopts), &(pkt->payload), &pkt->hdr, buf, buflen))) return rc; // coap_dumpOptions(opts, numopt); return 0; }
functions
ICACHE_FLASH_ATTR coap_findOptions(const coap_packet_t *pkt, uint8_t num, uint8_t *count) { // FIXME, options is always sorted, can find faster than this size_t i; const coap_option_t *first = NULL; *count = 0; for (i=0;i<pkt->numopts;i++) { if (pkt->opts[i].num == num) { if (NULL == first) first = &pkt->opts[i]; (*count)++; }
functions
ICACHE_FLASH_ATTR coap_buffer_to_string(char *strbuf, size_t strbuflen, const coap_buffer_t *buf) { if (buf->len+1 > strbuflen) return COAP_ERR_BUFFER_TOO_SMALL; memcpy(strbuf, buf->p, buf->len); strbuf[buf->len] = 0; return 0; }
functions
ICACHE_FLASH_ATTR coap_build(uint8_t *buf, size_t *buflen, const coap_packet_t *pkt) { size_t opts_len = 0; size_t i; uint8_t *p; uint16_t running_delta = 0; // build header if (*buflen < (4U + pkt->hdr.tkl)) return COAP_ERR_BUFFER_TOO_SMALL; buf[0] = (pkt->hdr.ver & 0x03) << 6; buf[0] |= (pkt->hdr.t & 0x03) << 4; buf[0] |= (pkt->hdr.tkl & 0x0F); buf[1] = pkt->hdr.code; buf[2] = pkt->hdr.id[0]; buf[3] = pkt->hdr.id[1]; // inject token p = buf + 4; if ((pkt->hdr.tkl > 0) && (pkt->hdr.tkl != pkt->tok.len)) return COAP_ERR_UNSUPPORTED; if (pkt->hdr.tkl > 0) memcpy(p, pkt->tok.p, pkt->hdr.tkl); // // http://tools.ietf.org/html/rfc7252#section-3.1 // inject options p += pkt->hdr.tkl; for (i=0;i<pkt->numopts;i++) { uint32_t optDelta; uint8_t len, delta = 0; if (((size_t)(p-buf)) > *buflen) return COAP_ERR_BUFFER_TOO_SMALL; optDelta = pkt->opts[i].num - running_delta; coap_option_nibble(optDelta, &delta); coap_option_nibble((uint32_t)pkt->opts[i].buf.len, &len); *p++ = (0xFF & (delta << 4 | len)); if (delta == 13) { *p++ = (optDelta - 13); }
functions
else if (delta == 14) { *p++ = ((optDelta-269) >> 8); *p++ = (0xFF & (optDelta-269)); }
functions
else if (len == 14) { *p++ = (pkt->opts[i].buf.len >> 8); *p++ = (0xFF & (pkt->opts[i].buf.len-269)); }
functions
options if (pkt->payload.len > 0) { if (*buflen < 4 + 1 + pkt->payload.len + opts_len) return COAP_ERR_BUFFER_TOO_SMALL; buf[4 + opts_len] = 0xFF; // payload marker memcpy(buf+5 + opts_len, pkt->payload.p, pkt->payload.len); *buflen = opts_len + 5 + pkt->payload.len; }
functions
ICACHE_FLASH_ATTR coap_option_nibble(uint32_t value, uint8_t *nibble) { if (value<13) { *nibble = (0xFF & value); }
functions
else if (value<=0xFF+13) { *nibble = 13; }
functions
else if (value<=0xFFFF+269) { *nibble = 14; }
functions
ICACHE_FLASH_ATTR coap_make_response(coap_rw_buffer_t *scratch, coap_packet_t *pkt, const uint8_t *content, size_t content_len, uint8_t msgid_hi, uint8_t msgid_lo, const coap_buffer_t* tok, coap_responsecode_t rspcode, coap_content_type_t content_type) { pkt->hdr.ver = 0x01; pkt->hdr.t = COAP_TYPE_ACK; pkt->hdr.tkl = 0; pkt->hdr.code = rspcode; pkt->hdr.id[0] = msgid_hi; pkt->hdr.id[1] = msgid_lo; pkt->numopts = 1; // need token in response if (tok) { pkt->hdr.tkl = tok->len; pkt->tok = *tok; }
functions
ICACHE_FLASH_ATTR coap_handle_req(coap_rw_buffer_t *scratch, const coap_packet_t *inpkt, coap_packet_t *outpkt) { const coap_option_t *opt; uint8_t count; int i; const coap_endpoint_t *ep = endpoints; while(NULL != ep->handler) { if (ep->method != inpkt->hdr.code) goto next; if (NULL != (opt = coap_findOptions(inpkt, COAP_OPTION_URI_PATH, &count))) { if (count != ep->path->count) goto next; for (i=0;i<count;i++) { if (opt[i].buf.len != strlen(ep->path->elems[i])) goto next; if (0 != memcmp(ep->path->elems[i], opt[i].buf.p, opt[i].buf.len)) goto next; }
functions
void coap_setup(void) { }
includes
#include <stdio.h>
includes
#include <stdlib.h>
includes
#include <string.h>
functions
else if ( flags & OUTPUT_FILE ) { if ( out_file == NULL ) { printf( "\nNo output file provided.\nQuitting\n\n" ); return EXIT_FAILURE; }
functions
Flag parse_args( int num_args, char* args[] ) { Flag flags = 0; short i, j; for ( i = 1; i < num_args; i++ ) { if ( strcmp( args[i], "--manpage" ) == 0 ) { print_man( args[0] ); exit( EXIT_SUCCESS ); }
functions
void print_man( char* prog_name ) { printf( "\nNAME\n\ttsl - generate test frames from a specification file\n" ); printf( "\nSYNOPSIS\n\ttsl [ --manpage ] [ -cs ] input_file [ -o output_file ]\n" ); printf( "\nDESCRIPTION\n\tThe TSL utility generates test frames from a specification file\n" ); printf( "\twritten in the extended Test Specification Language. By default\n" ); printf( "\tit writes the test frames to a new file created by appending a\n" ); printf( "\t'.tsl' extension to the input_file's name. Options can be used\n" ); printf( "\tto modify the output.\n" ); printf( "\nOPTIONS\n\tThe following options are supported:\n" ); printf( "\n\t--manpage\n\t\tPrint this man page.\n" ); printf( "\n\t-c\tReport the number of test frames generated, but don't\n" ); printf( "\t\twrite them to the output. After the number of frames is\n" ); printf( "\t\treported you will be given the option of writing them\n" ); printf( "\t\tto the output.\n" ); printf( "\n\t-s\tOutput is the standard output.\n" ); printf( "\n\t-o output_file\n\t\tOutput is the file output_file unless the -s option is used.\n\n" ); }
functions
int cleanup( void ) { Choice* curr_choice; int total_size = 0; short i, j; for ( i = 0; i < tot_cats; i++ ) { total_size += sizeof( Category ); for ( j = 0; j < cats[i] -> num_choices; j++ ) { total_size += sizeof( Choice ); curr_choice = cats[i] -> choices[j]; if ( curr_choice -> flags & IF_EXPR ) total_size += free_expr( curr_choice -> if_expr ); free( curr_choice ); }
functions
int free_expr( Expression* expr ) { int expr_size = sizeof( Expression ); if ( expr -> flags & EXPR_A ) expr_size += free_expr( expr -> exprA ); if ( expr -> flags & EXPR_B ) expr_size += free_expr( expr -> exprB ); free( expr ); return expr_size; }
main
int main( int argc, char* argv[] ) { Flag flags; /* program flags */ int num_frames; char filename[ 30 ], answer[ 5 ]; /* user response */ if ( argc == 1 ) { printf( "\nUSAGE: %s [ --manpage ] [ -cs ] input_file [ -o output_file ]\n\n", argv[0] ); return EXIT_SUCCESS; }
includes
#include <stdio.h>
includes
#include <stdlib.h>
includes
#include <unistd.h>
includes
#include <string.h>
includes
#include <errno.h>
includes
#include <fcntl.h>
includes
#include <sys/socket.h>
includes
#include <sys/stat.h>
includes
#include <aranea/aranea.h>
defines
#define CGI_EXT_LEN_ ((int)sizeof(CGI_EXT) - 1)
defines
#define CGI_BUFF g_buff
defines
#define CGI_ADD_ENV_(env, cnt, buf, ...) \
functions
int cgi_hit(const char *name, const int len) { if (len > CGI_EXT_LEN_) { if (memcmp(name + len - CGI_EXT_LEN_, CGI_EXT, CGI_EXT_LEN_) == 0) { return 1; }
functions
int cgi_is_executable(const char *path, struct client_t *client) { struct stat st; if (access(path, X_OK) != 0) { client->response.status_code = HTTP_STATUS_FORBIDDEN; return -1; }
functions
int cgi_gen_env(const struct request_t *req, char **env) { int cnt, len; char *buf; cnt = 0; buf = CGI_BUFF; #ifdef CGI_DOCUMENT_ROOT CGI_ADD_ENV_(env, cnt, buf, "DOCUMENT_ROOT=%s", g_config.root); #endif #ifdef CGI_REQUEST_METHOD CGI_ADD_ENV_(env, cnt, buf, "REQUEST_METHOD=%s", req->method); #endif #ifdef CGI_REQUEST_URI CGI_ADD_ENV_(env, cnt, buf, "REQUEST_URI=%s", req->url); #endif if (req->query_string) { CGI_ADD_ENV_(env, cnt, buf, "QUERY_STRING=%s", req->query_string); }
functions
CGI_HTTP_COOKIE if (req->header[HEADER_COOKIE]) { CGI_ADD_ENV_(env, cnt, buf, "HTTP_COOKIE=%s", req->header[HEADER_COOKIE]); }
functions
int cgi_exec(const char *path, struct client_t *client) { char *argv[2]; char *envp[MAX_CGIENV_ITEM]; pid_t pid; int newio; /* set socket back to blocking */ newio = fcntl(client->remote_fd, F_GETFL, NULL); if (newio == -1 || fcntl(client->remote_fd, F_SETFL, newio & (~O_NONBLOCK)) == -1) { A_ERR("fcntl: F_SETFL O_NONBLOCK %s", strerror(errno)); client->response.status_code = HTTP_STATUS_SERVERERROR; return -1; }
functions
int cgi_process(struct client_t *client, const char *path) { if (cgi_is_executable(path, client) != 0) { return -1; }
includes
#include <lcthw/darray_algos.h>
includes
#include <stdlib.h>
includes
#include <time.h>
includes
#include <limits.h>
functions
int intcmp(int **a, int **b) { return **a - **b; }
functions
int sintcmp(int *a, int *b) { return *a - *b; }
functions
int make_random(DArray *array, size_t n) { srand(time(NULL)); size_t i = 0; for(i = 0; i < n; i++) { int *random = DArray_new(array); *random = rand(); check(DArray_push(array, random) == 0, "Inserting random values failed."); }
functions
int is_sorted(DArray *array, DArray_compare cmp) { int i = 0; for(i = 0; i < DArray_count(array) - 1; i++) { if(cmp(DArray_get(array, i), DArray_get(array, i+1)) > 0) { return 0; }
includes
#include <common.h>
includes
#include <dm.h>
includes
#include <malloc.h>
includes
#include <sdhci.h>
includes
#include <fdtdec.h>
includes
#include <linux/libfdt.h>
includes
#include <asm/gpio.h>
includes
#include <asm/arch/mmc.h>
includes
#include <asm/arch/clk.h>
includes
#include <errno.h>
includes
#include <asm/arch/pinmux.h>
structs
struct s5p_sdhci_plat { struct mmc_config cfg; struct mmc mmc; };
functions
void s5p_sdhci_set_control_reg(struct sdhci_host *host) { unsigned long val, ctrl; /* * SELCLKPADDS[17:16] * 00 = 2mA * 01 = 4mA * 10 = 7mA * 11 = 9mA */ sdhci_writel(host, SDHCI_CTRL4_DRIVE_MASK(0x3), SDHCI_CONTROL4); val = sdhci_readl(host, SDHCI_CONTROL2); val &= SDHCI_CTRL2_SELBASECLK_MASK(3); val |= SDHCI_CTRL2_ENSTAASYNCCLR | SDHCI_CTRL2_ENCMDCNFMSK | SDHCI_CTRL2_ENFBCLKRX | SDHCI_CTRL2_ENCLKOUTHOLD; sdhci_writel(host, val, SDHCI_CONTROL2); /* * FCSEL3[31] FCSEL2[23] FCSEL1[15] FCSEL0[7] * FCSel[1:0] : Rx Feedback Clock Delay Control * Inverter delay means10ns delay if SDCLK 50MHz setting * 01 = Delay1 (basic delay) * 11 = Delay2 (basic delay + 2ns) * 00 = Delay3 (inverter delay) * 10 = Delay4 (inverter delay + 2ns) */ val = SDHCI_CTRL3_FCSEL0 | SDHCI_CTRL3_FCSEL1; sdhci_writel(host, val, SDHCI_CONTROL3); /* * SELBASECLK[5:4] * 00/01 = HCLK * 10 = EPLL * 11 = XTI or XEXTCLK */ ctrl = sdhci_readl(host, SDHCI_CONTROL2); ctrl &= ~SDHCI_CTRL2_SELBASECLK_MASK(0x3); ctrl |= SDHCI_CTRL2_SELBASECLK_MASK(0x2); sdhci_writel(host, ctrl, SDHCI_CONTROL2); }
functions
void s5p_set_clock(struct sdhci_host *host, u32 div) { /* ToDo : Use the Clock Framework */ set_mmc_clk(host->index, div); }
functions
int s5p_sdhci_core_init(struct sdhci_host *host) { host->name = S5P_NAME; host->quirks = SDHCI_QUIRK_NO_HISPD_BIT | SDHCI_QUIRK_BROKEN_VOLTAGE | SDHCI_QUIRK_32BIT_DMA_ADDR | SDHCI_QUIRK_WAIT_SEND_CMD | SDHCI_QUIRK_USE_WIDE8; host->max_clk = 52000000; host->voltages = MMC_VDD_32_33 | MMC_VDD_33_34 | MMC_VDD_165_195; host->ops = &s5p_sdhci_ops; if (host->bus_width == 8) host->host_caps |= MMC_MODE_8BIT; #ifndef CONFIG_BLK return add_sdhci(host, 0, 400000); #else return 0; #endif }
functions
int s5p_sdhci_init(u32 regbase, int index, int bus_width) { struct sdhci_host *host = calloc(1, sizeof(struct sdhci_host)); if (!host) { printf("sdhci__host allocation fail!\n"); return -ENOMEM; }
functions
int do_sdhci_init(struct sdhci_host *host) { int dev_id, flag, ret; flag = host->bus_width == 8 ? PINMUX_FLAG_8BIT_MODE : PINMUX_FLAG_NONE; dev_id = host->index + PERIPH_ID_SDMMC0; ret = exynos_pinmux_config(dev_id, flag); if (ret) { printf("external SD not configured\n"); return ret; }
functions
int sdhci_get_config(const void *blob, int node, struct sdhci_host *host) { int bus_width, dev_id; unsigned int base; /* Get device id */ dev_id = pinmux_decode_periph_id(blob, node); if (dev_id < PERIPH_ID_SDMMC0 || dev_id > PERIPH_ID_SDMMC3) { debug("MMC: Can't get device id\n"); return -EINVAL; }
functions
int process_nodes(const void *blob, int node_list[], int count) { struct sdhci_host *host; int i, node, ret; int failed = 0; debug("%s: count = %d\n", __func__, count); /* build sdhci_host[] for each controller */ for (i = 0; i < count; i++) { node = node_list[i]; if (node <= 0) continue; host = &sdhci_host[i]; ret = sdhci_get_config(blob, node, host); if (ret) { printf("%s: failed to decode dev %d (%d)\n", __func__, i, ret); failed++; continue; }
functions
int exynos_mmc_init(const void *blob) { int count; int node_list[SDHCI_MAX_HOSTS]; count = fdtdec_find_aliases_for_id(blob, "mmc", COMPAT_SAMSUNG_EXYNOS_MMC, node_list, SDHCI_MAX_HOSTS); return process_nodes(blob, node_list, count); }
functions
int s5p_sdhci_probe(struct udevice *dev) { struct s5p_sdhci_plat *plat = dev_get_platdata(dev); struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); struct sdhci_host *host = dev_get_priv(dev); int ret; ret = sdhci_get_config(gd->fdt_blob, dev_of_offset(dev), host); if (ret) return ret; ret = do_sdhci_init(host); if (ret) return ret; ret = sdhci_setup_cfg(&plat->cfg, host, 0, 400000); if (ret) return ret; host->mmc = &plat->mmc; host->mmc->priv = host; host->mmc->dev = dev; upriv->mmc = host->mmc; return sdhci_probe(dev); }
functions
int s5p_sdhci_bind(struct udevice *dev) { struct s5p_sdhci_plat *plat = dev_get_platdata(dev); int ret; ret = sdhci_bind(dev, &plat->mmc, &plat->cfg); if (ret) return ret; return 0; }
defines
#define __FIL_BUILDING_LOCKING__
functions
int _lock_init(PyFilLock *self, PyObject *args, PyObject *kwargs) { return 0; }
functions
void _lock_dealloc(PyFilLock *self) { assert(fil_waiterlist_empty(self->waiters)); PyObject_Del(self); }
functions
int __lock_acquire(PyFilLock *lock, int blocking, struct timespec *ts) { if (!lock->locked && fil_waiterlist_empty(lock->waiters)) { lock->locked = 1; return 0; }
functions
int __lock_release(PyFilLock *lock) { if (!lock->locked) { PyErr_SetString(PyExc_RuntimeError, "release without acquire"); return -1; }
functions
int __rlock_acquire(PyFilRLock *lock, int blocking, struct timespec *ts) { uint64_t owner; owner = fil_get_ident(); if (!lock->lock.locked && fil_waiterlist_empty(lock->lock.waiters)) { lock->lock.locked = 1; lock->owner = owner; lock->count = 1; return 0; }
functions
int __rlock_release(PyFilRLock *lock) { if (!lock->lock.locked || (fil_get_ident() != lock->owner)) { PyErr_SetString(PyExc_RuntimeError, "cannot release un-acquired lock"); return -1; }