---
name: "sergensio_get_user_data"
section: "3"
platform: "linux"
package: "libgensio-dev"
version: "2.8.13-7"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/gensio_to_sergensio"
---

# sergensio\_get\_user\_data(3)

General information and conversion routines for a sergensio

Part of [gensio\_to\_sergensio(3)](/gensio_to_sergensio/3.md).

## NAME

gensio\_to\_sergensio, sergensio\_to\_gensio, sergensio\_get\_user\_data, sergensio\_is\_client - General information and conversion routines for a sergensio

## SYNOPSIS

**#include \<gensio/sergensio.h\>**

- **struct sergensio \*gensio\_to\_sergensio(struct gensio \*io);**

  - **struct gensio \*sergensio\_to\_gensio(struct sergensio \*serio);**

  - **void \*sergensio\_get\_user\_data(struct sergensio \*serio);**

  - **bool sergensio\_is\_client(struct sergensio \*serio);**

  ## DESCRIPTION

**gensio\_to\_sergensio** return the sergensio object for a gensio.  It returns NULL if there is no sergensio for the gensio.  Note that this may be a sergensio object for a child of the passed in gensio.  If the passed in gensio is not a sergensio, it will search through the children for a gensio that is also a sergensio.  This way, say, if you have an conacc gensio running over a serialdev, and you receive an serial event, you can just call **gensio\_to\_sergensio** for the passed in object and it will give you the sergensio you should be working with.  The first time this is called on a gensio it associates the sergensio with the passed in gensio.

**sergensio\_to\_gensio** returns the gensio for a given sergensio.  It cannot fail.  Note that this returns the gensio passed in to **gensio\_to\_sergensio** not the gensio directly associated with the passed in sergensio.

**sergensio\_get\_user\_data** returns the gensio user data for the associated gensio.

**sergensio\_is\_client** returns true if the sergensio a client or false if it is a server.

## SEE ALSO

[sergensio(5)](/sergensio/5.md)

## AUTHOR

Corey Minyard \<minyard@acm.org\>
