namespaces.c (bf2e710b3cb8445c052f2ff50b4875a2523bb279) namespaces.c (544abd44c7064c8a58a6bd2073d757f6b91d98c5)
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License, version 2, as
4 * published by the Free Software Foundation.
5 *
6 * Copyright (C) 2017 Hari Bathini, IBM Corporation
7 */
8
9#include "namespaces.h"
10#include "util.h"
11#include "event.h"
12#include <sys/types.h>
13#include <sys/stat.h>
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License, version 2, as
4 * published by the Free Software Foundation.
5 *
6 * Copyright (C) 2017 Hari Bathini, IBM Corporation
7 */
8
9#include "namespaces.h"
10#include "util.h"
11#include "event.h"
12#include <sys/types.h>
13#include <sys/stat.h>
14#include <limits.h>
14#include <sched.h>
15#include <stdlib.h>
16#include <stdio.h>
17#include <string.h>
18#include <unistd.h>
19
20struct namespaces *namespaces__new(struct namespaces_event *event)
21{

--- 206 unchanged lines hidden (view full) ---

228 nc->oldns = -1;
229 }
230
231 if (nc->newns > -1) {
232 close(nc->newns);
233 nc->newns = -1;
234 }
235}
15#include <sched.h>
16#include <stdlib.h>
17#include <stdio.h>
18#include <string.h>
19#include <unistd.h>
20
21struct namespaces *namespaces__new(struct namespaces_event *event)
22{

--- 206 unchanged lines hidden (view full) ---

229 nc->oldns = -1;
230 }
231
232 if (nc->newns > -1) {
233 close(nc->newns);
234 nc->newns = -1;
235 }
236}
237
238char *nsinfo__realpath(const char *path, struct nsinfo *nsi)
239{
240 char *rpath;
241 struct nscookie nsc;
242
243 nsinfo__mountns_enter(nsi, &nsc);
244 rpath = realpath(path, NULL);
245 nsinfo__mountns_exit(&nsc);
246
247 return rpath;
248}