public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: xuyang2018.jy@fujitsu.com <xuyang2018.jy@fujitsu.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 3/3] syscalls/semctl01: Convert into new api
Date: Thu, 8 Apr 2021 02:02:53 +0000	[thread overview]
Message-ID: <606E7268.8000603@fujitsu.com> (raw)
In-Reply-To: <46e7a46a-f3d2-078d-1126-5a8679cea7be@oracle.com>

Hi Alexey
> On 23.03.2021 13:57, Yang Xu wrote:
>> From: Yang Xu<xuyang2018.jy@fujitsu.com>
>>   /*
>>    * These are the various setup and check functions for the 10 different
>>    * commands that are available for the semctl() call.
>> @@ -67,363 +29,171 @@ static void func_gval(int);
>>   static void sall_setup(void), func_sall(void);
>>   static void func_sval(void);
>>   static void func_rmid(void);
>> -static void child_cnt(void);
>> -static void child_pid(void);
>>   static void func_iinfo(int);
>>   static void func_sinfo(void);
>>   static void func_sstat(int);
>>
>
> We could drop all these declarations by moving tcases struct
> just before verify_semctl().
Yes. Thanks for catching this.

>> +
>> +static struct tst_test test = {
>> +	.setup = setup,
>> +	.cleanup = cleanup,
>> +	.test = verify_semctl,
>> +	.tcnt = ARRAY_SIZE(tests),
>> +	.needs_root = 1,
>
> Does it really require root?
See ftok(3) manpage, it said "The  ftok()  function uses the identity of 
the file named by the given pathname (which must refer to an existing, 
accessible file)".
ftok source code
key_t
ftok (const char *pathname, int proj_id)
{
   struct stat64 st;
   key_t key;

   if (__stat64 (pathname, &st) < 0)
     return (key_t) -1;

   key = ((st.st_ino & 0xffff) | ((st.st_dev & 0xff) << 16)
          | ((proj_id & 0xff) << 24));

   return key;
}

To ensure ftok succeed, we must require root. Or, modify GETIPCKEY api, 
we can use tmp directory. Anyhow, I will send a v2 to remove useless 
funtion declartion firstly.

Best Regards
Yang Xu
>
>> +	.forks_child = 1,
>> +};
>>
>
>

  reply	other threads:[~2021-04-08  2:02 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-23 10:57 [LTP] [PATCH 1/3] tst_safe_sysv_ipc.c: Add SAFE_SEMOP macro Yang Xu
2021-03-23 10:57 ` [LTP] [PATCH 2/3] tst_safe_sysv_ipc.c: Fix wrong ret_check Yang Xu
2021-04-07 17:28   ` Alexey Kodanev
2021-03-23 10:57 ` [LTP] [PATCH 3/3] syscalls/semctl01: Convert into new api Yang Xu
2021-04-07 17:33   ` Alexey Kodanev
2021-04-08  2:02     ` xuyang2018.jy [this message]
2021-04-08 10:33       ` Cyril Hrubis
2021-04-09  7:59         ` xuyang2018.jy
2021-04-09 10:11           ` Cyril Hrubis
2021-04-09 10:25             ` xuyang2018.jy
2021-04-09 11:55             ` [LTP] [PATCH v3 1/3] tst_safe_sysv_ipc.c: Add SAFE_SEMOP macro Yang Xu
2021-04-09 11:55               ` [LTP] [PATCH v3 2/3] tst_safe_sysv_ipc.c: Fix wrong ret_check Yang Xu
2021-04-09 11:55               ` [LTP] [PATCH v3 3/3] syscalls/semctl01: Convert into new api 1)Use SAFE MACRO 2)Remove useless macro and UCLINUX 3)Use IPC_PRIVATE instead of key Yang Xu
2021-04-09 14:34                 ` Alexey Kodanev
2021-04-12  8:20                   ` [LTP] [PATCH v4 1/3] tst_safe_sysv_ipc.c: Add SAFE_SEMOP macro Yang Xu
2021-04-12  8:20                     ` [LTP] [PATCH v4 2/3] tst_safe_sysv_ipc.c: Fix wrong ret_check Yang Xu
2021-04-12  8:20                     ` [LTP] [PATCH v4 3/3] syscalls/semctl01: Convert into new api Yang Xu
2021-04-19  1:42                     ` [LTP] [PATCH v4 1/3] tst_safe_sysv_ipc.c: Add SAFE_SEMOP macro xuyang2018.jy
2021-04-08  3:29     ` [LTP] [PATCH v2 " Yang Xu
2021-04-08  3:29       ` [LTP] [PATCH v2 2/3] tst_safe_sysv_ipc.c: Fix wrong ret_check Yang Xu
2021-04-08  3:29       ` [LTP] [PATCH v2 3/3] syscalls/semctl01: Convert into new api Yang Xu
2021-04-01  2:24 ` [LTP] [PATCH 1/3] tst_safe_sysv_ipc.c: Add SAFE_SEMOP macro xuyang2018.jy
2021-04-07 17:27 ` Alexey Kodanev

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=606E7268.8000603@fujitsu.com \
    --to=xuyang2018.jy@fujitsu.com \
    --cc=ltp@lists.linux.it \
    /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