source: rtems/c/src/tests/psxtests/psxstat/test.c @ 2e3ce06

4.104.114.84.95
Last change on this file since 2e3ce06 was 2e3ce06, checked in by Jennifer Averett <Jennifer.Averett@…>, on Nov 17, 2000 at 9:29:31 PM

2000-11-17 Jennifer Averret <jennifer@…>

  • psxmount/test.c, psxmount/psxmount.scn: Improve output to report expected error condition in one case.
  • psxreaddir/test.c, psxreaddir.scn: Added test cases to exercise readdir() of root of mounted filesystem. Also corrected the screen file for some mistakes noticed in this effort.
  • Property mode set to 100644
File size: 19.0 KB
Line 
1/*
2 *  This test exercises stat() via fstat() and generates as many of the
3 *  path evaluation cases as possible.
4 *
5 *  COPYRIGHT (c) 1989-1999.
6 *  On-Line Applications Research Corporation (OAR).
7 *
8 *  The license and distribution terms for this file may be
9 *  found in the file LICENSE in this distribution or at
10 *  http://www.OARcorp.com/rtems/license.html.
11 *
12 *  $Id$
13 */
14
15#include <tmacros.h>
16#include <assert.h>
17#include <sys/stat.h>
18#include <fcntl.h>
19#include <limits.h>
20#include <stdio.h>
21#include <unistd.h>
22#include <errno.h>
23#include <string.h>
24#include <rtems.h>
25#include <rtems/libio.h>
26#include <imfs.h>
27
28#define MAXSYMLINK 5   /* There needs to be a better way of getting this. */
29#define TIMEOUT_VALUE  ( 5 * TICKS_PER_SECOND )
30
31
32/*
33 *  List of files which should exist.
34 */
35
36char *Files[] = {
37  "/////my_mount_point/dir1/\\//file1\\\\//",
38  "/my_mount_point/dir1/file2",
39  "/my_mount_point/dir1/file3",
40  "/my_mount_point/dir1/file4",
41  "/my_mount_point/dir1/dir1/file1",
42  "../../..//my_mount_point/dir1/./././dir1/ file1",
43  "main.c",
44  0
45};
46
47/*
48 *  List of directories which should exist.
49 */
50
51char *Directories[] = {
52  "/my_mount_point/dir1",
53  "/my_mount_point/dir2",
54  "/my_mount_point/dir3",
55  "/my_mount_point/dir4",
56  "/my_mount_point/dir1/dir1",
57  "/./././my_mount_point/dir1/ dir1",
58  "/./././my_mount_point/links", 
59  "///my_mount_point/dir1/dir1/../../dir1/../symlinks/////",
60  0
61};
62
63char *Links_to_Dirs[]= {
64  "dir1/dir1/../../links/dir1",
65  "links/dir2",
66  "links/dir3",
67  "links/dir4",
68  "links/dir1_dir1",
69  "links/dir1_ dir1",
70  "links/../links/../links/links",
71  0
72};
73
74char *Links_to_Files[]= {
75  "links/dir1_file1",
76  "links/dir1_file2",
77  "links/dir1_file3",
78  "links/dir1_file4",
79  "links/dir1_dir1_f1",
80  "links/dir1_dir1 f1",
81  0
82};
83
84char *Links_to_dirlinks[]= {
85  "links/links/links/links_dir1",
86  "links//links_dir2",
87  "links//links_dir3",
88  "links//links_dir4",
89  "links//links_dir1_d1",
90  "links//links_dir1 d1",
91  "links//links_links",
92  0
93};
94
95char *Links_to_filelinks[]= {
96  "links///links_d1_file1",
97  "links///links_d1_file2",
98  "links///links_d1_file3",
99  "links///links_d1_file4",
100  "links///links_d1_d1_f1",
101  "links///links_r1_d1 f1",
102  0
103};
104
105char *SymLinks[]= {
106  "/my_mount_point/symlinks/a_file_symlink",
107  "/my_mount_point/symlinks/a_dir_symlink",
108  "/my_mount_point/symlinks/a_link_symlink",
109  "../symlinks/no_file",
110  "/my_mount_point/symlinks/a_dir_symlink/a_file_symlink",
111  0
112};
113
114/*
115 *  List of absolute paths to stat.
116 */
117
118char *Good_absolute_paths[] = {
119  "/my_mount_point/dev",
120  "////my_mount_point/dir1/\\//file1\\\\//",
121  "/my_mount_point/dir1/\\\\/file2",
122  "/my_mount_point/dir1/file3/////\\\\\\",
123  "/my_mount_point/dir1/file4",
124  "/my_mount_point/dir1/dir1/file1",
125  "/my_mount_point/dir1/dir1/ file1",
126  "/my_mount_point/dir1",
127  "/my_mount_point/dir2//////\\",
128  "/my_mount_point/dir3",
129  "/my_mount_point/dir4",
130  "/my_mount_point/dir1/dir1",
131  "/my_mount_point/dir1/ dir1///\\\\",
132  "/my_mount_point/\\/\\/\\/\\/\\/\\/links\\/\\/\\/\\/\\/\\",
133  0
134};
135
136
137char *Bad_paths[] = {
138  "/my_mount_point/links/ENAMETOOLONG__________________________",
139  "/my_mount_point/dir1/file4/NOTADIR",
140  "/my_mount_point/dir1/dir1/EACCES__",
141  0
142};
143
144/*
145 *  List of relative paths to stat.
146 */
147
148char *Good_relative_paths[] = {
149  "dev",
150  "dir1/\\//file1\\\\//",
151  "dir1/\\\\/file2",
152  "dir1/file3/////\\\\\\",
153  "dir1/file4",
154  "dir1/dir1/file1",
155  "dir1/dir1/ file1",
156  "dir1",
157  "dir2//////\\",
158  "dir3",
159  "dir4",
160  "dir1/dir1",
161  "dir1/ dir1///\\\\",
162  "main.c",
163  0
164};
165
166/*
167 *  Do a stat on a single file and report the status.
168 */
169
170void stat_a_file(
171  const char *file
172)
173{
174  int         status;
175  struct stat statbuf;
176  int         major1;
177  int         minor1;
178  int         major2;
179  int         minor2;
180
181
182  assert( file );
183
184  printf( "stat( %s ) returned ", file );
185  fflush( stdout );
186
187  status = stat( file, &statbuf );
188
189  if ( status == -1 ) {
190    printf( ": %s\n", strerror( errno ) );
191  } else {
192
193    rtems_filesystem_split_dev_t( statbuf.st_dev, major1, minor1 );
194    rtems_filesystem_split_dev_t( statbuf.st_rdev, major2, minor2 );
195
196
197    printf("\n\tst_dev     (0x%x:0x%x)\n", major1, minor1 );
198    printf(  "...st_ino     %x\n", (int) statbuf.st_ino );
199    printf(  "...st_mode    %o\n", statbuf.st_mode );
200    printf(  "...st_nlink   %x\n", statbuf.st_nlink );
201    printf(  "...st_uid     %d\n", statbuf.st_uid );
202    printf(  "...st_gid     %d\n", statbuf.st_gid );
203    printf(  "...st_rdev    (0x%x:0x%x)\n", major2, minor2 );
204    printf(  "...st_size    %d\n",(unsigned int) statbuf.st_size );
205    printf(  "...st_atime   %s", ctime( &statbuf.st_atime ) );
206    printf(  "...st_mtime   %s", ctime( &statbuf.st_mtime ) );
207    printf(  "...st_ctime   %s", ctime( &statbuf.st_ctime ) );
208#if defined(__svr4__) && !defined(__PPC__) && !defined(__sun__)
209    printf(  "...st_blksize %x\n", statbuf.st_blksize );
210    printf(  "...st_blocks  %x\n", statbuf.st_blocks );
211#endif
212
213  }
214}
215
216/*
217 *  stat() multiple files at a time
218 */
219
220void stat_multiple_files(
221  char **files
222)
223{
224  int    i;
225
226  i = 0;
227  while ( files[i] ) {
228    stat_a_file( files[i] );
229    i++;
230  }
231}
232
233/*
234 *  chown() multiple files at a time
235 */
236void chown_multiple_files(
237  char **files
238)
239{
240  int    i;
241  uid_t  st_uid;
242  gid_t  st_gid;
243
244  st_uid = geteuid();
245  st_gid = getegid();
246
247  i = 0;
248  while ( files[i] ) {
249    printf("Change group of %s\n", files[i]);
250    chown( files[i], st_uid, (st_gid+1) );
251    stat_a_file( files[i] );
252
253    printf("Change owner of %s\n", files[i]);
254    chown( files[i], (st_uid+1), st_gid );
255    stat_a_file( files[i] );
256    i++;
257  }
258
259}
260
261
262
263/*
264 *  mknod() multiple files at a time
265 */
266
267void make_multiple_files(
268  char **files
269)
270{
271  int    i;
272  int    status;
273
274  i = 0;
275  while ( files[i] ) {
276    printf( "Making file %s\n", files[i] );
277    status = mknod( files[i], ( S_IFREG | S_IROTH|S_IWOTH ), 0LL );
278    assert( !status );
279    i++;
280  }
281  puts( "" );
282}
283
284void make_multiple_bad_files(
285  char **files
286)
287{
288  int    i;
289  int    status;
290
291  i = 0;
292  while ( files[i] ) {
293    printf( "Making file %s ", files[i] );
294    status = mknod( files[i], ( S_IFREG | S_IROTH|S_IWOTH ), 0LL );
295    assert( status );
296    printf( ": %s\n", strerror( errno ) );
297    i++;
298  }
299  puts( "" );
300}
301
302void make_multiple_links(
303  char **existing,
304  char **new
305)
306{
307  int    i;
308  int    status;
309
310  i = 0;
311  while ( new[i] && existing[i] ) {
312    printf( "Making file %s\n", new[i] );
313    status = link( existing[i], new[i] );
314    assert( !status );
315    i++;
316  }
317  puts( "" );
318
319  status = link( "fred", "bob" );
320  assert( status == -1 );
321
322  status = link( existing[1], "doug/bob" );
323  assert( status == -1 );
324}
325
326
327void make_too_many_links()
328{
329  int    i;
330  int    status;
331  char   name [20];
332
333  status = mkdir("/dummy", S_IRWXU );
334  assert( status == 0 );
335
336  for (i=1; i<= LINK_MAX; i++) {
337
338    sprintf(name,"/LinkName%d",i);
339    printf( "Making file %s\n", name );
340    status = link("/dummy" , name );
341    if( i < LINK_MAX )
342       assert( !status );
343    else
344       assert( status == -1 );
345
346  }
347}
348
349
350void make_a_symlink(
351  char *existing,
352  char *new
353)
354{
355  int    status;
356  char   buf[100];
357  int    len;
358
359  memset( buf, 0, 100 );
360
361  printf( "Making file %s\n", new );
362  status = symlink( existing, new );
363  assert( !status );
364
365  printf( "Verify with readlink\n");
366  status = readlink( new, buf, 100 );
367  len = strlen( existing );
368  assert ( status == len );
369
370  status = readlink( new, buf, 3 );
371  len = strlen( existing );
372  if (len < 3 )
373    assert( status == len );
374  else
375    assert( status == 3 );
376
377  status = strcmp( existing, buf );
378  assert( !status );
379}
380
381void make_multiple_symlinks()
382{
383 int  status;
384
385 make_a_symlink( Files[0],             SymLinks[0] );
386 make_a_symlink( Directories[0],       SymLinks[1] );
387 make_a_symlink( Links_to_dirlinks[0], SymLinks[2] );
388 make_a_symlink( "No_File",            SymLinks[3] );
389 make_a_symlink( SymLinks[1],          SymLinks[4] );
390 make_a_symlink( "//my_mount_point/links","/my_mount_point/symlinks/links" );
391
392 stat_a_file( SymLinks[0] );
393 stat_a_file( SymLinks[1] );
394 stat_a_file( SymLinks[2] );
395 stat_a_file( SymLinks[3] );
396 stat_a_file( SymLinks[4] );
397
398 status = symlink(  "//links", "bob/frank" );
399 assert (status == -1);
400
401}
402/*
403void make_too_many_symlinks()
404{
405  int  i, status;
406  char name1[8];
407
408  for (i=1; i <= MAXSYMLINK; i++) {
409    sprintf( name1, "SymLink%d", i );
410    status = symlink( "/dummy", name1 );
411    if( i < MAXSYMLINK )
412       assert( !status );
413    else
414       assert( status == -1 );
415  }
416}
417*/
418void make_many_symlinks(
419  char  *real_file,
420  int    link_count
421)
422{
423  int  i;
424  char name1[5];
425  char name2[5];
426  char *link_file;
427
428  link_file = real_file;
429  for (i=1; i < link_count; i++) {
430    sprintf( name1, "%d", i );
431    make_a_symlink( link_file, name1 );
432    strcpy( name2, name1 );
433    link_file = name2;
434  }
435
436  for (i=1; i < link_count; i++) {
437    sprintf( name1, "%d", i );
438    stat_a_file( name1 );
439  }
440
441}
442
443/*
444 *  mkdir() multiple directories at a time
445 */
446 
447void make_multiple_directories(
448  char **files
449) 
450{
451  int    i;
452  int    status;
453
454  i = 0; 
455  while ( files[i] ) {
456    printf( "Making directory %s\n", files[i] );
457    status = mkdir( files[i], S_IRWXU );
458    assert( !status );
459    i++;
460  }
461  puts( "" );
462} 
463
464/*
465 * Cause faults.
466 */
467
468
469void Cause_faults()
470{
471  int                                   fd;
472  int                                   status;
473  char                                  longer_name[100];
474  rtems_filesystem_mount_table_entry_t *mt_entry;
475
476  /*
477   * Verify chmod with an invalid type.
478   */
479
480  printf("\n\nPass an invalid mode to chmod should fail with EPERM \n" );
481  status = chmod( Files[0], S_IFREG );
482  assert( status == -1 ); 
483  assert( errno == EPERM );
484
485  /*
486   * Try to chdir to a file.
487   */
488
489  printf("chdir to a file should fail with ENOTDIR\n");
490  status = chdir( Files[0] );
491  assert( status == -1 );
492  assert( errno == ENOTDIR );
493
494  /*
495   * Change mode to read/write on a directory.
496   * Verify directory works properly.
497   */
498
499  printf("Verify RWX permission on %s via access\n", Directories[0]);
500  status = access( Directories[0], ( R_OK | W_OK | X_OK )  );
501  assert( status == 0 );
502
503  printf( "chmod of %s to Read/Write\n", Directories[0] );
504  status = chmod( Directories[0], (S_IXGRP | S_IXOTH) );
505  assert( status == 0 );
506
507  printf( "chmod fred should fail with ENOENT\n" );
508  status = chmod( "fred", (S_IXGRP | S_IXOTH) );
509  assert( status == -1 );
510  assert( errno == ENOENT );
511
512  strcpy(longer_name, Directories[0] );
513  strcat(longer_name, "/BADNAME" );
514  printf( "Create under %s should fail with EACCES\n", Directories[0] );
515  status = mkdir( longer_name , S_IRWXU );
516  assert( status == -1 );
517  assert( errno == EACCES );
518
519  printf("chdir to %s should fail with EACCES\n", Directories[4] );
520  status = chdir( Directories[4] );
521  assert( status == -1 );
522  assert( errno == EACCES );
523
524  /*
525   * Check stat with a NULL buffer.
526   */
527
528  printf("Stat with a NULL buffer should fail with EFAULT\n");
529  status = stat( Directories[0], NULL );
530  assert( status == -1 );
531  assert( errno == EFAULT );
532
533  /*
534   * Set current to a directory with no owner permissions.
535   * Verify it works properly.
536   */
537
538  printf( "\n\nchmod of %s to Read/Write\n", Directories[0] );
539  status = chmod( Directories[0], (S_IXGRP | S_IXOTH) );
540  assert( status == 0 );
541
542  printf("mkdir %s should fail with EACCESS\n", longer_name );
543  status = mkdir( longer_name , S_IRWXU );
544  assert( status == -1 );
545  assert( errno == EACCES );
546
547  printf("\n%s Should exist ( access )\n",Directories[0] );
548  status = access( Directories[0], F_OK );
549  assert( status == 0 );
550  printf("\n%s Should have read  permission( access )\n",Directories[0] );
551  status = access( Directories[0], R_OK );
552  assert( status != 0 );
553  printf("\n%s Should have write permission( access )\n",Directories[0] );
554  status = access( Directories[0], W_OK );
555  assert( status != 0 );
556  printf("\n%s Should not have execute permission( access )\n",Directories[0] );
557  status = access( Directories[0], X_OK );
558  assert( status != 0 );
559 
560  printf("\nRestore %s to RWX\n",Directories[0] );
561  status = chmod( Directories[0], S_IRWXU );
562  assert( status == 0 );
563
564  printf("chdir to /my_mount_point \n");
565  status = chdir( "/my_mount_point" );
566  assert( status == 0 );
567
568  /*
569   * Remove one of the directories.
570   * Verify links to the removed directory still work.
571   */
572
573  printf( "Remove %s\n", Directories[5] );
574  status = rmdir( Directories[5] );
575  assert( status == 0 );
576
577  stat_a_file( Directories[5] );
578  status = access( Directories[5], F_OK );
579  assert( status != 0 );
580
581  stat_a_file( Links_to_Dirs[5] );
582  status = readlink( Links_to_Dirs[5], longer_name, 3 );
583  assert( status == -1 );
584  assert( errno == EINVAL );
585
586  stat_a_file( Links_to_dirlinks[5] );
587  printf("Chdir to %s\n", Links_to_Dirs[5] );
588  status = chdir( Links_to_Dirs[5] );
589  assert( status == 0 );
590
591  /*
592   * Verify we cannot move up from a node with no parent node.
593   */
594
595  printf("Chdir to .. should fail with ENOENT\n" );
596  status = chdir( ".." );
597  assert( status == -1 );
598  assert( errno == ENOENT );
599
600  /*
601   * Create a subdirectory under the dangling node.
602   */
603
604  printf("mkdir ../t should fail with ENOENT\n" );
605  status = mkdir( "../t" , S_IRWXU );
606  assert( status == -1 );
607  assert( errno == ENOENT );
608
609  printf("mkdir t\n");
610  status = mkdir( "t" , S_IRWXU );
611  assert( status == 0 );
612
613  printf("chdir to /my_mount_point\n");
614  status = chdir( "/my_mount_point" );
615  assert( status == 0 );
616
617  /*
618   * Check rmdir, rmnod, and unlink
619   */
620
621  printf("rmdir %s should fail with ENOTDIR\n", Links_to_Dirs[5] );
622  status = rmdir( Links_to_Dirs[5] );
623  assert( status == -1 );
624  assert( errno == ENOTDIR );
625
626  printf("unlink %s\n", Links_to_Dirs[5] );
627  status = unlink( Links_to_Dirs[5] );
628  assert( status == 0 );
629
630  printf("unlink %s should fail with ENOTEMPTY\n", Links_to_dirlinks[5] );
631  status = unlink(  Links_to_dirlinks[5] );
632  assert( status == -1 );
633  assert( errno == ENOTEMPTY );
634
635  strcpy( longer_name,  Links_to_dirlinks[5] );
636  strcat( longer_name, "/t");
637  printf("rmdir %s\n", longer_name );
638  status = rmdir( longer_name );
639  assert( status == 0 );
640
641  printf("unlink %s\n", Links_to_Dirs[5]);
642  status = unlink( Links_to_dirlinks[5] );
643  assert( status == 0 );
644
645  status = chdir( Directories[0] );
646  status = mkdir ( "my_mount_point", S_IRWXU );
647  assert( status == 0 );
648
649  printf("Attempting to mount IMFS file system at /dir1/my_mount_point \n");
650  status = mount(
651     &mt_entry,
652     &IMFS_ops,
653     RTEMS_FILESYSTEM_READ_WRITE,
654     NULL,
655     "/my_mount_point/dir1/my_mount_point" );
656  assert( status == 0 );
657
658  printf("rmdir /dir1/my_mount_point should fail with EBUSY\n");
659  status = rmdir ("/my_mount_point/dir1/my_mount_point" );
660  assert( status == -1 );
661  assert( errno == EBUSY );
662
663  printf( "Unmount /my_mount_point/dir1/my_mount_point\n");
664  status = unmount( "/my_mount_point/dir1/my_mount_point" );
665  assert( status == 0 );
666
667  /*
668   * Verify write permission is checked.
669   */
670
671  printf("chmod of %s to group and other execute\n", Files[0] );
672  status = chmod (Files[0], (S_IXGRP | S_IXOTH) );
673  assert( status == 0 );
674
675  printf("Open %s for write should fail with EACCES\n", Files[0] );
676  fd = open (Files[0], O_WRONLY); 
677  assert( fd == -1 );
678  assert( errno == EACCES );
679
680  printf("chmod of %s to User Execute and Read\n", Directories[3] );
681  status = chmod (Directories[3], (S_IXUSR | S_IRUSR) );
682  assert( status == 0 );
683  strcpy(longer_name, Directories[3] );
684  strcat(longer_name, "/NewFile" );
685  printf("Mkdir of %s should fail with EACCES\n",longer_name );
686  status = mkdir( longer_name, S_IRWXU );
687  assert( status != 0 );
688  assert( errno == EACCES );
689
690  printf(" Making too many hard links.\n" );
691  make_too_many_links( );
692
693  printf( "pass fstat a null pointer should fail with EFAULT\n");
694  status = fstat( fd, NULL );
695  assert( status == -1 ); 
696  assert( errno == EFAULT);
697
698  /*
699   * The current directory MUST be restored at the end of this test.
700   */
701
702  printf("chdir to /my_mount_point \n");
703  status = chdir( "/my_mount_point" );
704  assert( status == 0 );
705
706}
707
708void Show_Time()
709{
710  rtems_time_of_day time;
711  rtems_status_code status;
712
713  status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
714  printf(">>>>Current Time: ");
715  print_time( " - rtems_clock_get - ", &time, "\n" );
716}
717
718/*
719 *  main entry point to the test
720 */
721
722#if defined(__rtems__)
723int test_main(void)
724#else
725int main(
726  int    argc,
727  char **argv
728)
729#endif
730{
731  rtems_status_code                    status;
732  rtems_time_of_day                    time;
733  rtems_filesystem_mount_table_entry_t *mt_entry;
734
735  puts( "\n\n*** STAT TEST 01 ***" );
736
737  build_time( &time, 12, 31, 1988, 9, 0, 0, 0 );
738  status = rtems_clock_set( &time );
739  Show_Time();
740
741  /*
742   * Create and mount another version of the filesyste.
743   * This allows expected node id's to be consistant across
744   * platforms and bsp's.
745   */
746
747  status = mkdir("/my_mount_point",  S_IRWXU );
748  assert( status == 0 );
749  status = mount(
750     &mt_entry,
751     &IMFS_ops,
752     RTEMS_FILESYSTEM_READ_WRITE,
753     NULL,
754     "my_mount_point" );
755  assert( status == 0 );
756  status = chdir( "/my_mount_point" );
757  assert( status == 0 );
758  status = mkdir("dev",  S_IRWXU );
759  assert( status == 0 );
760
761
762  /*
763   *  Create the files and directories for the test.
764   */
765
766  make_multiple_directories( Directories );
767  make_multiple_files( Files );
768  make_multiple_links( Directories,    Links_to_Dirs );
769  make_multiple_links( Files,          Links_to_Files );
770
771  status = rtems_task_wake_after( TIMEOUT_VALUE );
772  make_multiple_links( Links_to_Dirs,  Links_to_dirlinks );
773  status = rtems_task_wake_after( TIMEOUT_VALUE );
774  make_multiple_links( Links_to_Files, Links_to_filelinks );
775
776  status = rtems_task_wake_after( TIMEOUT_VALUE );
777
778  /*
779   *  Now go through all the absolute path.
780   */
781
782  puts( "Doing the stat() on all the good absolute paths" );
783  stat_multiple_files( Good_absolute_paths );
784
785  /*
786   *  run through the relative paths.
787   */
788
789  puts( "\nDoing the stat() on all the good relative paths" );
790  stat_multiple_files( Good_relative_paths );
791
792  /*
793   * Change directory and releative paths are now bad.
794   */
795
796  puts("\nchdir to dev");
797  chdir("dev");
798  puts("\nstat relative paths that are now bad");
799  stat_multiple_files( Good_relative_paths );
800
801  /*
802   * Change directory to the link directory and follow links.
803   */
804
805  puts("\nchdir to ../links");
806  chdir("../links");
807  puts("Doing the stat() on good links\n");
808  stat_multiple_files( Links_to_Dirs );
809  stat_multiple_files( Links_to_Files );
810  stat_multiple_files( Links_to_dirlinks  );
811  stat_multiple_files( Links_to_filelinks );
812 
813  /*
814   * Chmod on dir1/dir1.  This allows the error path to be hit.
815   */
816
817  printf( "chmod of %s to Read/Write\n", Directories[4] );
818  chmod( Directories[4], (S_IROTH|S_IWOTH) );
819  puts( "\nDoing the stat() on all the bad paths" );
820
821  stat_multiple_files( Bad_paths );
822  make_multiple_bad_files( Bad_paths );
823
824  printf( "Return %s to RWX\n", Directories[4] );
825  chmod( Directories[4], S_IRWXU );
826
827
828  /*
829   * Check out symbolic links.
830   */
831
832  make_multiple_symlinks();
833  make_many_symlinks( "/symlinks", 10 );
834
835  status = rtems_task_wake_after( TIMEOUT_VALUE );
836  Cause_faults();
837
838  status = rtems_task_wake_after( TIMEOUT_VALUE );
839  chown_multiple_files( Files );
840
841  status = rtems_task_wake_after( TIMEOUT_VALUE );
842  chown_multiple_files( Links_to_Dirs );
843 
844  puts( "\n\n*** END OF STAT TEST 01 ***" );
845  exit(0);
846}
847
848
849
850
851
852
853
Note: See TracBrowser for help on using the repository browser.