TT_OPEN(3)

πŸ“¦
version 2.5.3 Β· 2 versions
, in nixos 26.05

πŸ’… tt_open β€” bestie, let's get you an ID

okay so real talk, the manual page calls this tt_open(library call) and honestly? that's the whole vibe: this is the library call version of tt_open πŸ’–


✨ NAME ✨

tt_open β€” returns the process identifier for the calling process, like a little name tag for your process at the ToolTalk party πŸŽ€


🌸 SYNOPSIS 🌸

#include <Tt/tt_c.h>
char *tt_open(void)

πŸ¦‹ DESCRIPTION πŸ¦‹

The tt_open function returns the process identifier for the calling process. That's it, that's the whole function, and she ate πŸ’…


πŸ‘‘ RETURN VALUE πŸ‘‘

okay so tt_open also sets this identifier as the default procid for the process. Fancy, right? And tt_open(3) is typically the very first ToolTalk function a process calls β€” she's the main character, the opener of doors πŸšͺ✨

Your application must call tt_open(3) before making other tt_ calls. Periodt. But there are exactly two exceptions, and yes we're listing them because they're iconic:

Those two can be called before tt_open. Everybody else? Wait your turn πŸ™ˆ

A process can call tt_open more than once to obtain multiple procids β€” no cap, collect them like stickers πŸ’– To open another session, the process must make the following calls in the order specified:

tt_default_session_set
tt_open

order matters, bestie, don't freestyle it 🫢


⭐ RETURN VALUE ⭐ (yes, again, she has two β€” queen behavior)

Upon successful completion, the tt_open function returns the character value that uniquely identifies the process. You can use tt_ptr_error(3) to extract one of the following Tt_status values from that returned pointer:

  • TT_OK β€” The operation completed successfully. slay ✨
  • TT_ERR_NOMP β€” The ttsession(1) process is not running and the ToolTalk service cannot restart it. 😭 yeah that's a yikes

🌈 APPLICATION USAGE 🌈

Your app should use tt_free(3) to free any data stored in the address returned by the ToolTalk API. Clean up after yourself, it's giving self-care 🧚

Each procid has its own associated file descriptor, and can join another session. And if you want to switch to another procid? Call tt_default_procid_set. Easy. Done. Iconic πŸ‘‘


πŸ”₯ SEE ALSO πŸ”₯

ngl go read those too, iykyk πŸ’œ

and that's the page, bestie πŸŽ€ big kisses from the tt_open(library call) corner β€” both the header up top and the footer down here just say tt_open(library call), so consider this your cute sign-off: library call energy, tt_open, periodt πŸ’…πŸŒΈπŸ¦‹

πŸ“¦ where this page comes from