---
title: vfs_context_current
framework: Kernel
role: symbol
role_heading: Function
platforms: [macOS 10.5+]
path: kernel/1562223-vfs_context_current
---

# vfs_context_current

Get the vfs_context for the current thread, or the kernel context if there is no context for current thread.

## Declaration

```occ
vfs_context_t vfs_context_current(void);
```

## Return Value

Return Value Context for current thread, or kernel context if thread context is unavailable.

## Discussion

Discussion Kexts should not use this function--it is preferred to use vfs_context_create(NULL) and vfs_context_rele(), which ensure proper reference counting of underlying structures.
