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

# vcount

Count total references to a given file, disregarding "kusecount" (event listener, as with O_EVTONLY) references.

## Declaration

```occ
int vcount(vnode_t vp);
```

## Parameters

- `vp`: The vnode whose references to count.

## Return Value

Return Value Count of references.

## Discussion

Discussion For a regular file, just return (usecount-kusecount); for device files, return the sum over all vnodes 'v' which reference that device of (usecount(v) - kusecount(v)). Note that this is merely a snapshot and could be invalid by the time the caller checks the result.
