tools/perf/util/namespaces.h
Source file repositories/reference/linux-study-clean/tools/perf/util/namespaces.h
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/util/namespaces.h- Extension
.h- Size
- 2008 bytes
- Lines
- 85
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
sys/types.hsys/stat.hlinux/stddef.hlinux/perf_event.hlinux/refcount.hlinux/types.hinternal/rc_check.h
Detected Declarations
struct perf_record_namespacesstruct namespacesstruct nscookiefunction __nsinfo__zput
Annotated Snippet
struct namespaces {
struct list_head list;
u64 end_time;
struct perf_ns_link_info link_info[];
};
struct namespaces *namespaces__new(struct perf_record_namespaces *event);
void namespaces__free(struct namespaces *namespaces);
DECLARE_RC_STRUCT(nsinfo) {
pid_t pid;
pid_t tgid;
pid_t nstgid;
bool need_setns;
bool in_pidns;
char *mntns_path;
refcount_t refcnt;
};
struct nscookie {
int oldns;
int newns;
char *oldcwd;
};
int nsinfo__init(struct nsinfo *nsi);
struct nsinfo *nsinfo__new(pid_t pid);
struct nsinfo *nsinfo__copy(const struct nsinfo *nsi);
struct nsinfo *nsinfo__get(struct nsinfo *nsi);
void nsinfo__put(struct nsinfo *nsi);
bool nsinfo__need_setns(const struct nsinfo *nsi);
void nsinfo__clear_need_setns(struct nsinfo *nsi);
pid_t nsinfo__tgid(const struct nsinfo *nsi);
pid_t nsinfo__nstgid(const struct nsinfo *nsi);
pid_t nsinfo__pid(const struct nsinfo *nsi);
bool nsinfo__in_pidns(const struct nsinfo *nsi);
void nsinfo__set_in_pidns(struct nsinfo *nsi);
void nsinfo__mountns_enter(struct nsinfo *nsi, struct nscookie *nc);
void nsinfo__mountns_exit(struct nscookie *nc);
char *nsinfo__realpath(const char *path, struct nsinfo *nsi);
int nsinfo__stat(const char *filename, struct stat *st, struct nsinfo *nsi);
bool nsinfo__is_in_root_namespace(void);
static inline void __nsinfo__zput(struct nsinfo **nsip)
{
if (nsip) {
nsinfo__put(*nsip);
*nsip = NULL;
}
}
#define nsinfo__zput(nsi) __nsinfo__zput(&nsi)
const char *perf_ns__name(unsigned int id);
#endif /* __PERF_NAMESPACES_H */
Annotation
- Immediate include surface: `sys/types.h`, `sys/stat.h`, `linux/stddef.h`, `linux/perf_event.h`, `linux/refcount.h`, `linux/types.h`, `internal/rc_check.h`.
- Detected declarations: `struct perf_record_namespaces`, `struct namespaces`, `struct nscookie`, `function __nsinfo__zput`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.