1
0
mirror of https://gitlab.labs.nic.cz/labs/bird.git synced 2024-05-11 16:54:54 +00:00

Unix: Refactor tracked files

We need access to resource in order to free it.
This commit is contained in:
Ondrej Zajicek (work)
2018-11-13 18:13:11 +01:00
parent d0b4597842
commit c68ba7d093
3 changed files with 30 additions and 14 deletions

View File

@@ -55,6 +55,7 @@
this to gen small latencies */
#define MAX_RX_STEPS 4
/*
* Tracked Files
*/
@@ -89,17 +90,29 @@ static struct resclass rf_class = {
NULL
};
void *
tracked_fopen(pool *p, char *name, char *mode)
struct rfile *
rf_open(pool *p, char *name, char *mode)
{
FILE *f = fopen(name, mode);
if (f)
{
struct rfile *r = ralloc(p, &rf_class);
r->f = f;
}
return f;
if (!f)
return NULL;
struct rfile *r = ralloc(p, &rf_class);
r->f = f;
return r;
}
void *
rf_file(struct rfile *f)
{
return f->f;
}
int
rf_fileno(struct rfile *f)
{
return fileno(f->f);
}