clone2(2)

πŸ’– clone2(2) πŸ’–

okay bestie, sit down, hydrate, because we're talking about clone2 and __clone2 β€” the system-call manual, section 2 β€” and their whole entire job is: create a child process. ✨ That's it. That's the gig. Not me being dramatic, that's literally the NAME section.


🌸 LIBRARY 🌸

Standard C library β€” that's libc, linked with -lc, as always. 🫢


✨ SYNOPSIS ✨

here's the glibc wrapper, look at her:

       // glibc wrapper:
       int __clone2(typeof(int (void *)) *fn,
                    void *stack_base, size_t stack_size,
                    int flags, void *arg, ...
                 /* pid_t *parent_tid, struct user_desc *tls,
                    pid_t *child_tid */ );

and here's the raw system call, the unglamorous one:

       // System call:
       long syscall(SYS_clone2, unsigned long flags, void *stack_base,
                   int stack_size,         /* Size of stack */
                   int *parent_tid, int *child_tid,
                   unsigned long tls);

no cap, stack_size in the syscall version is literally commented as /* Size of stack */ right there in the signature, which is giving "we knew you'd ask." πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so. These interfaces are similar to clone(2) β€” like, cousins β€” but for ia64. ia64 girlies only, sorry to everyone else. πŸŽ€

They operate in the same way as clone(2), with one (1) whole exception, and it's about the stack:

  • stack_base points to the lowest address of the child's stack area β€” like, the bottom-bottom, not the top.
  • stack_size specifies the size of the stack pointed to by stack_base.

that's the whole plot twist. the rest? identical to clone(2). periodt. πŸ‘‘


πŸ’œ RETURN VALUE πŸ’œ

See clone(2). I'm not repeating myself, she already said it. πŸ’…


🌈 ERRORS 🌈

See clone(2). same energy, same errors, go read her. 😭


⭐ STANDARDS ⭐

None.

literally none. not a single one. she's built different and unstandardised. πŸ’€


πŸ‘‘ HISTORY πŸ‘‘

Linux (ia64). an icon, a legend, and she is the moment. 🌸


🫢 SEE ALSO 🫢

that's the whole friend group btw. just the two of them. iykyk. 🧚


bestie reminder: this is the ia64-flavoured clone(2) and the stack_base / stack_size semantics are genuinely different from regular clone(2). do not mix them up, i'm begging. πŸ™ˆ

this page was brought to you by Linux man-pages 6.20, dated 2026-06-08 β€” mwah, slay, bye πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from
  • arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
  • nixpkgs unstable: man-pages 6.20
  • πŸ“œ the page's license: GPL-1.0-or-later
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms