forked from Imagelibrary/rtems
New.
This commit is contained in:
1
testsuites/libtests/POSIX/.cvsignore
Normal file
1
testsuites/libtests/POSIX/.cvsignore
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Makefile.in
|
||||||
8
testsuites/libtests/POSIX/COPYING
Normal file
8
testsuites/libtests/POSIX/COPYING
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009 by
|
||||||
|
* Ralf Corsépius, Ulm, Germany. All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software
|
||||||
|
* is freely granted, provided that this notice is preserved.
|
||||||
|
*/
|
||||||
|
|
||||||
101
testsuites/libtests/POSIX/Makefile.am
Normal file
101
testsuites/libtests/POSIX/Makefile.am
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
CC = @CC@ $(GCCSPECS)
|
||||||
|
|
||||||
|
check_PROGRAMS =
|
||||||
|
|
||||||
|
check_PROGRAMS += calloc
|
||||||
|
calloc_SOURCES = calloc.c
|
||||||
|
|
||||||
|
check_PROGRAMS += close
|
||||||
|
close_SOURCES = close.c
|
||||||
|
|
||||||
|
check_PROGRAMS += dup2
|
||||||
|
dup2_SOURCES = dup2.c
|
||||||
|
|
||||||
|
check_PROGRAMS += fcntl
|
||||||
|
fcntl_SOURCES = fcntl.c
|
||||||
|
|
||||||
|
check_PROGRAMS += fork
|
||||||
|
fork_SOURCES = fork.c
|
||||||
|
|
||||||
|
check_PROGRAMS += free
|
||||||
|
free_SOURCES = free.c
|
||||||
|
|
||||||
|
check_PROGRAMS += fstat
|
||||||
|
fstat_SOURCES = fstat.c
|
||||||
|
|
||||||
|
# FIXME: BSD-proprietary
|
||||||
|
# check_PROGRAMS += getdents
|
||||||
|
# getdents_SOURCES = getdents.c
|
||||||
|
|
||||||
|
check_PROGRAMS += getlogin
|
||||||
|
getlogin_SOURCES = getlogin.c
|
||||||
|
|
||||||
|
check_PROGRAMS += getpwnam
|
||||||
|
getpwnam_SOURCES = getpwnam.c
|
||||||
|
|
||||||
|
check_PROGRAMS += getpwuid
|
||||||
|
getpwuid_SOURCES = getpwuid.c
|
||||||
|
|
||||||
|
check_PROGRAMS += getuid
|
||||||
|
getuid_SOURCES = getuid.c
|
||||||
|
|
||||||
|
# FIXME: BSD-proprietary
|
||||||
|
# check_PROGRAMS += issetugid
|
||||||
|
# issetugid_SOURCES = issetugid.c
|
||||||
|
|
||||||
|
check_PROGRAMS += lseek
|
||||||
|
lseek_SOURCES = lseek.c
|
||||||
|
|
||||||
|
check_PROGRAMS += longjmp
|
||||||
|
longjmp_SOURCES = longjmp.c
|
||||||
|
|
||||||
|
check_PROGRAMS += lstat
|
||||||
|
lstat_SOURCES = lstat.c
|
||||||
|
|
||||||
|
check_PROGRAMS += kill
|
||||||
|
kill_SOURCES = kill.c
|
||||||
|
|
||||||
|
check_PROGRAMS += malloc
|
||||||
|
malloc_SOURCES = malloc.c
|
||||||
|
|
||||||
|
check_PROGRAMS += nanosleep
|
||||||
|
nanosleep_SOURCES = nanosleep.c
|
||||||
|
|
||||||
|
check_PROGRAMS += open
|
||||||
|
open_SOURCES = open.c
|
||||||
|
|
||||||
|
check_PROGRAMS += pipe
|
||||||
|
pipe_SOURCES = pipe.c
|
||||||
|
|
||||||
|
check_PROGRAMS += posix_memalign
|
||||||
|
posix_memalign_SOURCES = posix_memalign.c
|
||||||
|
|
||||||
|
check_PROGRAMS += read
|
||||||
|
read_SOURCES = read.c
|
||||||
|
|
||||||
|
check_PROGRAMS += realloc
|
||||||
|
realloc_SOURCES = realloc.c
|
||||||
|
|
||||||
|
check_PROGRAMS += setjmp
|
||||||
|
setjmp_SOURCES = setjmp.c
|
||||||
|
|
||||||
|
check_PROGRAMS += sigfillset
|
||||||
|
sigfillset_SOURCES = sigfillset.c
|
||||||
|
|
||||||
|
check_PROGRAMS += sigprocmask
|
||||||
|
sigprocmask_SOURCES = sigprocmask.c
|
||||||
|
|
||||||
|
check_PROGRAMS += stat
|
||||||
|
stat_SOURCES = stat.c
|
||||||
|
|
||||||
|
check_PROGRAMS += unlink
|
||||||
|
unlink_SOURCES = unlink.c
|
||||||
|
|
||||||
|
check_PROGRAMS += vfork
|
||||||
|
vfork_SOURCES = vfork.c
|
||||||
|
|
||||||
|
check_PROGRAMS += waitpid
|
||||||
|
waitpid_SOURCES = waitpid.c
|
||||||
|
|
||||||
|
check_PROGRAMS += write
|
||||||
|
write_SOURCES = write.c
|
||||||
25
testsuites/libtests/POSIX/README
Normal file
25
testsuites/libtests/POSIX/README
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
This testsuite consists of a collection of (non-functional) programs snippets
|
||||||
|
to check an RTEMS toolchain consisting of
|
||||||
|
* GCC (libgcc etc.)
|
||||||
|
* binutils
|
||||||
|
* newlib (libc)
|
||||||
|
* RTEMS (librtemscpu + librtemsbsp)
|
||||||
|
for IEEE Std 1003.1-2008 (aka. POSIX[1]) compliance by link-tests.
|
||||||
|
|
||||||
|
All of these programs are supposed to be compilable without any warning,
|
||||||
|
independently of the configuration being used in any of the components
|
||||||
|
involved.
|
||||||
|
|
||||||
|
NB:
|
||||||
|
- Using "advanced GCC warning flags" may trigger warnings. Such warnings
|
||||||
|
should be avoided if possible.
|
||||||
|
|
||||||
|
- These program snippets are not supposed to be functional.
|
||||||
|
|
||||||
|
- This suite only checks for a subset of POSIX library calls, which are
|
||||||
|
known to have been critical in RTEMS/GCC/newlib interaction at some point
|
||||||
|
in RTEMS/GCC/newlib's history.
|
||||||
|
|
||||||
|
References:
|
||||||
|
[1] The Open Group Base Specifications Issue 7, IEEE Std 1003.1™-2008,
|
||||||
|
http://www.opengroup.org/onlinepubs/9699919799
|
||||||
17
testsuites/libtests/POSIX/calloc.c
Normal file
17
testsuites/libtests/POSIX/calloc.c
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009 by
|
||||||
|
* Ralf Corsépius, Ulm, Germany. All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software
|
||||||
|
* is freely granted, provided that this notice is preserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main (void)
|
||||||
|
{
|
||||||
|
void *foo = calloc (42, 43);
|
||||||
|
|
||||||
|
return (foo != NULL);
|
||||||
|
}
|
||||||
17
testsuites/libtests/POSIX/close.c
Normal file
17
testsuites/libtests/POSIX/close.c
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009 by
|
||||||
|
* Ralf Corsépius, Ulm, Germany. All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software
|
||||||
|
* is freely granted, provided that this notice is preserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main (void)
|
||||||
|
{
|
||||||
|
close (42);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
20
testsuites/libtests/POSIX/dup2.c
Normal file
20
testsuites/libtests/POSIX/dup2.c
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009 by
|
||||||
|
* Ralf Corsépius, Ulm, Germany. All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software
|
||||||
|
* is freely granted, provided that this notice is preserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main (void)
|
||||||
|
{
|
||||||
|
int oldfd = 42;
|
||||||
|
int newfd = 43;
|
||||||
|
|
||||||
|
dup2 (oldfd, newfd);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
19
testsuites/libtests/POSIX/fcntl.c
Normal file
19
testsuites/libtests/POSIX/fcntl.c
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009 by
|
||||||
|
* Ralf Corsépius, Ulm, Germany. All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software
|
||||||
|
* is freely granted, provided that this notice is preserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main (void)
|
||||||
|
{
|
||||||
|
fcntl (42, 43);
|
||||||
|
fcntl (42, 43, 44);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
17
testsuites/libtests/POSIX/fork.c
Normal file
17
testsuites/libtests/POSIX/fork.c
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009 by
|
||||||
|
* Ralf Corsépius, Ulm, Germany. All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software
|
||||||
|
* is freely granted, provided that this notice is preserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main (void)
|
||||||
|
{
|
||||||
|
fork ();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
17
testsuites/libtests/POSIX/free.c
Normal file
17
testsuites/libtests/POSIX/free.c
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009 by
|
||||||
|
* Ralf Corsépius, Ulm, Germany. All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software
|
||||||
|
* is freely granted, provided that this notice is preserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main (void)
|
||||||
|
{
|
||||||
|
free ((void *) 42);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
21
testsuites/libtests/POSIX/fstat.c
Normal file
21
testsuites/libtests/POSIX/fstat.c
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009 by
|
||||||
|
* Ralf Corsépius, Ulm, Germany. All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software
|
||||||
|
* is freely granted, provided that this notice is preserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main (void)
|
||||||
|
{
|
||||||
|
struct stat buf;
|
||||||
|
int fd = 42;
|
||||||
|
fstat (fd, &buf);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
18
testsuites/libtests/POSIX/getdents.c
Normal file
18
testsuites/libtests/POSIX/getdents.c
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009 by
|
||||||
|
* Ralf Corsépius, Ulm, Germany. All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software
|
||||||
|
* is freely granted, provided that this notice is preserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <dirent.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main (void)
|
||||||
|
{
|
||||||
|
int status;
|
||||||
|
int fd = 42;
|
||||||
|
|
||||||
|
status = getdents (fd, "/tmp/foo", 0);
|
||||||
|
}
|
||||||
18
testsuites/libtests/POSIX/getlogin.c
Normal file
18
testsuites/libtests/POSIX/getlogin.c
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009 by
|
||||||
|
* Ralf Corsépius, Ulm, Germany. All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software
|
||||||
|
* is freely granted, provided that this notice is preserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main (void)
|
||||||
|
{
|
||||||
|
char *login;
|
||||||
|
login = getlogin ();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
19
testsuites/libtests/POSIX/getpwnam.c
Normal file
19
testsuites/libtests/POSIX/getpwnam.c
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009 by
|
||||||
|
* Ralf Corsépius, Ulm, Germany. All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software
|
||||||
|
* is freely granted, provided that this notice is preserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <pwd.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main (void)
|
||||||
|
{
|
||||||
|
struct passwd *pass;
|
||||||
|
pass = getpwnam ("root");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
19
testsuites/libtests/POSIX/getpwuid.c
Normal file
19
testsuites/libtests/POSIX/getpwuid.c
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009 by
|
||||||
|
* Ralf Corsépius, Ulm, Germany. All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software
|
||||||
|
* is freely granted, provided that this notice is preserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <pwd.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main (void)
|
||||||
|
{
|
||||||
|
struct passwd *pass;
|
||||||
|
pass = getpwnam (0);
|
||||||
|
|
||||||
|
return (pass != NULL);
|
||||||
|
}
|
||||||
19
testsuites/libtests/POSIX/getuid.c
Normal file
19
testsuites/libtests/POSIX/getuid.c
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009 by
|
||||||
|
* Ralf Corsépius, Ulm, Germany. All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software
|
||||||
|
* is freely granted, provided that this notice is preserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main (void)
|
||||||
|
{
|
||||||
|
uid_t uid;
|
||||||
|
uid = getuid ();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
18
testsuites/libtests/POSIX/issetugid.c
Normal file
18
testsuites/libtests/POSIX/issetugid.c
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009 by
|
||||||
|
* Ralf Corsépius, Ulm, Germany. All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software
|
||||||
|
* is freely granted, provided that this notice is preserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main (void)
|
||||||
|
{
|
||||||
|
int status;
|
||||||
|
status = issetugid ();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
21
testsuites/libtests/POSIX/kill.c
Normal file
21
testsuites/libtests/POSIX/kill.c
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009 by
|
||||||
|
* Ralf Corsépius, Ulm, Germany. All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software
|
||||||
|
* is freely granted, provided that this notice is preserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main (void)
|
||||||
|
{
|
||||||
|
pid_t pid = 0;
|
||||||
|
|
||||||
|
kill (pid, SIGHUP);
|
||||||
|
kill (pid, SIGKILL);
|
||||||
|
kill (pid, SIGTERM);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
17
testsuites/libtests/POSIX/longjmp.c
Normal file
17
testsuites/libtests/POSIX/longjmp.c
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009 by
|
||||||
|
* Ralf Corsépius, Ulm, Germany. All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software
|
||||||
|
* is freely granted, provided that this notice is preserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <setjmp.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main (void)
|
||||||
|
{
|
||||||
|
jmp_buf buf;
|
||||||
|
longjmp (buf, 0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
23
testsuites/libtests/POSIX/lseek.c
Normal file
23
testsuites/libtests/POSIX/lseek.c
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009 by
|
||||||
|
* Ralf Corsépius, Ulm, Germany. All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software
|
||||||
|
* is freely granted, provided that this notice is preserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main (void)
|
||||||
|
{
|
||||||
|
off_t res;
|
||||||
|
int fd = 42;
|
||||||
|
|
||||||
|
res = lseek (fd, 0, SEEK_SET);
|
||||||
|
res = lseek (fd, 1, SEEK_CUR);
|
||||||
|
res = lseek (fd, 2, SEEK_END);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
22
testsuites/libtests/POSIX/lstat.c
Normal file
22
testsuites/libtests/POSIX/lstat.c
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009 by
|
||||||
|
* Ralf Corsépius, Ulm, Germany. All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software
|
||||||
|
* is freely granted, provided that this notice is preserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main (void)
|
||||||
|
{
|
||||||
|
struct stat buf;
|
||||||
|
int status;
|
||||||
|
|
||||||
|
status = lstat ("/tmp/foo", &buf);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
17
testsuites/libtests/POSIX/malloc.c
Normal file
17
testsuites/libtests/POSIX/malloc.c
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009 by
|
||||||
|
* Ralf Corsépius, Ulm, Germany. All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software
|
||||||
|
* is freely granted, provided that this notice is preserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main (void)
|
||||||
|
{
|
||||||
|
void *ptr = malloc (42);
|
||||||
|
|
||||||
|
return (ptr != NULL);
|
||||||
|
}
|
||||||
21
testsuites/libtests/POSIX/nanosleep.c
Normal file
21
testsuites/libtests/POSIX/nanosleep.c
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009 by
|
||||||
|
* Ralf Corsépius, Ulm, Germany. All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software
|
||||||
|
* is freely granted, provided that this notice is preserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main (void)
|
||||||
|
{
|
||||||
|
struct timespec req = { 0, 42 };
|
||||||
|
struct timespec rem;
|
||||||
|
int status;
|
||||||
|
|
||||||
|
status = nanosleep (&req, &rem);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
23
testsuites/libtests/POSIX/open.c
Normal file
23
testsuites/libtests/POSIX/open.c
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009 by
|
||||||
|
* Ralf Corsépius, Ulm, Germany. All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software
|
||||||
|
* is freely granted, provided that this notice is preserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main (void)
|
||||||
|
{
|
||||||
|
int fd1;
|
||||||
|
int fd2;
|
||||||
|
|
||||||
|
fd1 = open ("/tmp/foo1", O_RDWR | O_APPEND);
|
||||||
|
fd2 = open ("/tmp/foo2", O_CREAT, S_IWUSR);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
20
testsuites/libtests/POSIX/pipe.c
Normal file
20
testsuites/libtests/POSIX/pipe.c
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009 by
|
||||||
|
* Ralf Corsépius, Ulm, Germany. All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software
|
||||||
|
* is freely granted, provided that this notice is preserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main (void)
|
||||||
|
{
|
||||||
|
int filedes[2];
|
||||||
|
int status;
|
||||||
|
|
||||||
|
status = pipe (filedes);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
18
testsuites/libtests/POSIX/posix_memalign.c
Normal file
18
testsuites/libtests/POSIX/posix_memalign.c
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009 by
|
||||||
|
* Ralf Corsépius, Ulm, Germany. All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software
|
||||||
|
* is freely granted, provided that this notice is preserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main (void)
|
||||||
|
{
|
||||||
|
void *a;
|
||||||
|
int ret = posix_memalign (&a, sizeof (void *) * 2, 42);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
21
testsuites/libtests/POSIX/read.c
Normal file
21
testsuites/libtests/POSIX/read.c
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009 by
|
||||||
|
* Ralf Corsépius, Ulm, Germany. All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software
|
||||||
|
* is freely granted, provided that this notice is preserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main (void)
|
||||||
|
{
|
||||||
|
int fd = 42;
|
||||||
|
char buf[4];
|
||||||
|
ssize_t len;
|
||||||
|
|
||||||
|
len = read (fd, &buf, 4);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
17
testsuites/libtests/POSIX/realloc.c
Normal file
17
testsuites/libtests/POSIX/realloc.c
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009 by
|
||||||
|
* Ralf Corsépius, Ulm, Germany. All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software
|
||||||
|
* is freely granted, provided that this notice is preserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main (void)
|
||||||
|
{
|
||||||
|
realloc (NULL, 42);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
17
testsuites/libtests/POSIX/setjmp.c
Normal file
17
testsuites/libtests/POSIX/setjmp.c
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009 by
|
||||||
|
* Ralf Corsépius, Ulm, Germany. All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software
|
||||||
|
* is freely granted, provided that this notice is preserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <setjmp.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main (void)
|
||||||
|
{
|
||||||
|
jmp_buf buf;
|
||||||
|
setjmp (buf);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
19
testsuites/libtests/POSIX/sigfillset.c
Normal file
19
testsuites/libtests/POSIX/sigfillset.c
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009 by
|
||||||
|
* Ralf Corsépius, Ulm, Germany. All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software
|
||||||
|
* is freely granted, provided that this notice is preserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main (void)
|
||||||
|
{
|
||||||
|
sigset_t set;
|
||||||
|
int status;
|
||||||
|
status = sigfillset (&set);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
22
testsuites/libtests/POSIX/sigprocmask.c
Normal file
22
testsuites/libtests/POSIX/sigprocmask.c
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009 by
|
||||||
|
* Ralf Corsépius, Ulm, Germany. All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software
|
||||||
|
* is freely granted, provided that this notice is preserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main (void)
|
||||||
|
{
|
||||||
|
int status;
|
||||||
|
sigset_t set1, set2;
|
||||||
|
|
||||||
|
status = sigprocmask (SIG_BLOCK, &set1, &set2);
|
||||||
|
status = sigprocmask (SIG_UNBLOCK, &set1, &set2);
|
||||||
|
status = sigprocmask (SIG_SETMASK, &set1, &set2);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
22
testsuites/libtests/POSIX/stat.c
Normal file
22
testsuites/libtests/POSIX/stat.c
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009 by
|
||||||
|
* Ralf Corsépius, Ulm, Germany. All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software
|
||||||
|
* is freely granted, provided that this notice is preserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main (void)
|
||||||
|
{
|
||||||
|
struct stat buf;
|
||||||
|
int status;
|
||||||
|
|
||||||
|
status = stat ("/tmp/foo", &buf);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
18
testsuites/libtests/POSIX/unlink.c
Normal file
18
testsuites/libtests/POSIX/unlink.c
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009 by
|
||||||
|
* Ralf Corsépius, Ulm, Germany. All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software
|
||||||
|
* is freely granted, provided that this notice is preserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main (void)
|
||||||
|
{
|
||||||
|
int status;
|
||||||
|
status = unlink ("/tmp/foo");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
19
testsuites/libtests/POSIX/vfork.c
Normal file
19
testsuites/libtests/POSIX/vfork.c
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009 by
|
||||||
|
* Ralf Corsépius, Ulm, Germany. All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software
|
||||||
|
* is freely granted, provided that this notice is preserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main (void)
|
||||||
|
{
|
||||||
|
pid_t pid;
|
||||||
|
pid = vfork ();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
20
testsuites/libtests/POSIX/waitpid.c
Normal file
20
testsuites/libtests/POSIX/waitpid.c
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009 by
|
||||||
|
* Ralf Corsépius, Ulm, Germany. All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software
|
||||||
|
* is freely granted, provided that this notice is preserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/wait.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main (void)
|
||||||
|
{
|
||||||
|
int status;
|
||||||
|
pid_t pid;
|
||||||
|
pid = waitpid (-1, &status, WNOHANG);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
21
testsuites/libtests/POSIX/write.c
Normal file
21
testsuites/libtests/POSIX/write.c
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009 by
|
||||||
|
* Ralf Corsépius, Ulm, Germany. All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software
|
||||||
|
* is freely granted, provided that this notice is preserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main (void)
|
||||||
|
{
|
||||||
|
char string[] = "1234";
|
||||||
|
size_t count = 4;
|
||||||
|
ssize_t ret;
|
||||||
|
|
||||||
|
ret = write (0, &string, count);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user