summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.syscall/chmod.c
blob: 724b86c42e18677f82f4a047263eeab7a4810969 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/* COVERAGE: chmod fchmod chown fchown lchown */
/* COVERAGE: chown16 fchown16 lchown16 */
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/syscall.h>

int main()
{
  int fd;

  fd = open("foobar",O_WRONLY|O_CREAT, 0666);
  //staptest// open ("foobar", O_WRONLY|O_CREAT, 0666) = NNNN

  chmod("foobar", 0644);
  //staptest// chmod ("foobar", 0644)
  //staptest//   fchmodat (AT_FDCWD, "foobar", 0644) = 0

  fchmod(fd, 0444);
  //staptest// fchmod (NNNN, 0444) = 0

  chown("foobar", 5000, -1);
#ifdef __i386__
  //staptest// chown ("foobar", 5000, -1) =
#else
  //staptest// chown ("foobar", 5000, NNNN) =
#endif

  chown("foobar", -1, 5001);
#ifdef __i386__
  //staptest// chown ("foobar", -1, 5001) =
#else
  //staptest// chown ("foobar", NNNN, 5001) =
#endif

  fchown(fd, 5002, -1);
#ifdef __i386__
  //staptest// fchown (NNNN, 5002, -1) =
#else
  //staptest// fchown (NNNN, 5002, NNNN) =
#endif

  fchown(fd, -1, 5003);
#ifdef __i386__
  //staptest// fchown (NNNN, -1, 5003) =
#else
  //staptest// fchown (NNNN, NNNN, 5003) =
#endif

  lchown("foobar", 5004, -1);
#ifdef __i386__
  //staptest// lchown ("foobar", 5004, -1) =
#else
  //staptest// lchown ("foobar", 5004, NNNN) =
#endif

  lchown("foobar", -1, 5005);
#ifdef __i386__
  //staptest// lchown ("foobar", -1, 5005) =
#else
  //staptest// lchown ("foobar", NNNN, 5005) =
#endif

#ifdef __i386__
  syscall(SYS_chown, "foobar", 5000, -1);
  //staptest// chown16 ("foobar", 5000, -1) =
  syscall(SYS_chown, "foobar", -1, 5001);
  //staptest// chown16 ("foobar", -1, 5001) =
  syscall(SYS_fchown, fd, 5002, -1);
  //staptest// fchown16 (NNNN, 5002, -1) =
  syscall(SYS_fchown, fd, -1, 5003);
  //staptest// fchown16 (NNNN, -1, 5003) =
  syscall(SYS_lchown, "foobar", 5004, -1);
  //staptest// lchown16 ("foobar", 5004, -1) =
  syscall(SYS_lchown, "foobar", -1, 5005);
  //staptest// lchown16 ("foobar", -1, 5005) =
#endif

  close(fd);
  return 0;
}