linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Wilk <jwilk@jwilk.net>
To: Jonny Grant <jg@jguk.org>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>, <linux-man@vger.kernel.org>
Subject: Re: gettid
Date: Wed, 17 Jun 2020 12:22:32 +0200	[thread overview]
Message-ID: <20200617102232.7zzi2klj3onh2nur@jwilk.net> (raw)
In-Reply-To: <23ca3363-5a24-9862-4872-811678527b50@jguk.org>

[-- Attachment #1: Type: text/plain, Size: 662 bytes --]

* Jonny Grant <jg@jguk.org>, 2020-06-16, 12:36:
>SYNOPSIS         top
>   #define _GNU_SOURCE
>   #include <unistd.h>
>   #include <sys/types.h>
>
>   pid_t gettid(void);
>
>I can compile on Ubuntu without #define _GNU_SOURCE and call gettid()
>
>Maybe that line can be removed?

I don't think so. Here's what I get (with GCC 9):

   $ gcc test.c
   test.c: In function ‘main’:
   test.c:6:9: warning: implicit declaration of function ‘gettid’; did you mean ‘getgid’? [-Wimplicit-function-declaration]
       6 |  return gettid();
         |         ^~~~~~
         |         getgid

Prepending "#define _GNU_SOURCE" fixes the above.

-- 
Jakub Wilk

[-- Attachment #2: test.c --]
[-- Type: text/x-csrc, Size: 99 bytes --]

#include <unistd.h>
#include <sys/types.h>

int main(int argc, char **argv)
{
	return gettid();	
}

  reply	other threads:[~2020-06-17 10:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-16 11:36 gettid Jonny Grant
2020-06-17 10:22 ` Jakub Wilk [this message]
2020-06-17 11:14   ` gettid Jonny Grant
2020-06-17 12:10     ` gettid Ponnuvel Palaniyappan
2020-06-17 12:26       ` gettid Jonny Grant

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200617102232.7zzi2klj3onh2nur@jwilk.net \
    --to=jwilk@jwilk.net \
    --cc=jg@jguk.org \
    --cc=linux-man@vger.kernel.org \
    --cc=mtk.manpages@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).