xref: /aosp_15_r20/external/ltp/testcases/kernel/syscalls/sysfs/sysfs02.c (revision 49cdfc7efb34551c7342be41a7384b9c40d7cab7)
1*49cdfc7eSAndroid Build Coastguard Worker // SPDX-License-Identifier: GPL-2.0-only
2*49cdfc7eSAndroid Build Coastguard Worker /*
3*49cdfc7eSAndroid Build Coastguard Worker  * Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
4*49cdfc7eSAndroid Build Coastguard Worker  */
5*49cdfc7eSAndroid Build Coastguard Worker 
6*49cdfc7eSAndroid Build Coastguard Worker /*\
7*49cdfc7eSAndroid Build Coastguard Worker  * [Description]
8*49cdfc7eSAndroid Build Coastguard Worker  *
9*49cdfc7eSAndroid Build Coastguard Worker  * This test is run for option 2 for sysfs(2).
10*49cdfc7eSAndroid Build Coastguard Worker  * Translate the filesystem type index fs_index into a null-terminated filesystem
11*49cdfc7eSAndroid Build Coastguard Worker  * identifier string. This string will be written to the buffer pointed to by buf.
12*49cdfc7eSAndroid Build Coastguard Worker  * Make sure that buf has enough space to accept the string.
13*49cdfc7eSAndroid Build Coastguard Worker  */
14*49cdfc7eSAndroid Build Coastguard Worker 
15*49cdfc7eSAndroid Build Coastguard Worker #include <errno.h>
16*49cdfc7eSAndroid Build Coastguard Worker #include <unistd.h>
17*49cdfc7eSAndroid Build Coastguard Worker #include <sys/syscall.h>
18*49cdfc7eSAndroid Build Coastguard Worker #include "tst_test.h"
19*49cdfc7eSAndroid Build Coastguard Worker #include "lapi/syscalls.h"
20*49cdfc7eSAndroid Build Coastguard Worker 
verify_sysfs02(void)21*49cdfc7eSAndroid Build Coastguard Worker static void verify_sysfs02(void)
22*49cdfc7eSAndroid Build Coastguard Worker {
23*49cdfc7eSAndroid Build Coastguard Worker 	char buf[40];
24*49cdfc7eSAndroid Build Coastguard Worker 
25*49cdfc7eSAndroid Build Coastguard Worker 	TST_EXP_PASS(tst_syscall(__NR_sysfs, 2, 0, buf), "sysfs(2,0,buf)");
26*49cdfc7eSAndroid Build Coastguard Worker }
27*49cdfc7eSAndroid Build Coastguard Worker 
28*49cdfc7eSAndroid Build Coastguard Worker static struct tst_test test = {
29*49cdfc7eSAndroid Build Coastguard Worker 	.test_all = verify_sysfs02,
30*49cdfc7eSAndroid Build Coastguard Worker };
31