---
name: "kstate"
section: "2"
platform: "linux"
package: "lam2-dev"
version: "6.3.2-3"
release: "Debian 2.2 (Potato)"
platforms: ["linux"]
url: "https://new.carta.tech/kstate"
---

# kstate(2)

Get synchronization status of a LAM process.

## NAME

kstate - Get synchronization status of a LAM process.

## SYNOPSIS

\#include \<kreq.h\>

int kstate (int pid, struct kstatus \*status);

## DESCRIPTION

The function *kstate()* enables a LAM process to inquire about the synchronization status of any process on the local node, including itself. The argument *pid* is the identifier of the process to be stated. The special identifier 0 indicates the calling process. Information returned from the daemon will be stored in the structure addressed by the *status* argument. The structure is defined in \<kreq.h\> as shown below.

```
	struct kstatus {
		int	ks_state;
		int	ks_priority;
		int	ks_event;
		int	ks_type;
		int	ks_signal;
		int	ks_flags;
		int	ks_length;
		int	ks_fyi[KNFYI];
	};
```

Upon return from *kstate()*, the individual fields are filled with the information described below.

- ks\_state

  scheduling status (see below)

- ks\_priority

  synchronization priority (see [kenter(2)](/kenter/2.md))

- ks\_event

  currently blocked or last used message event

- ks\_type

  currently blocked or last used message type

- ks\_signal

  pending signals to be delivered

- ks\_flags

  internal process management flags

- ks\_length

  currently blocked or last used message length

- ks\_fyi

  application specific information

The process states, defined in \<kreq.h\>, are described below.

- KSREADY

  ready to run

- KSRECV

  blocked on [krecv(2)](/krecv/2.md) to receive a message

- KSSEND

  blocked on [ksend(2)](/ksend/2.md) to send a message

## ERRORS

- ENOTPROCESS

  The process whose process identifier was passed to *kstate()* is not a LAM process.

- ENOTATTACHED

  The calling process is not a LAM process.

## SEE ALSO

[rpstate(2)](/rpstate/2.md)
