First public contribution.
1 /** @file ../include/unistd.h
5 /** @fn access(const char *fn, int flags)
9 @return Upon successful completion, the value 0 is returned; otherwise the
10 value -1 is returned and the global variable errno is set to indicate the
13 The access system calls check the accessibility of the file named in the fn argument for the access permissions indicated by the flags argument.
14 The value of flags is either the bitwise-inclusive OR of the access permissions to be
15 checked (R_OK for read permission, W_OK for write permission, and X_OK for execute/search permission), or the existence test ( F_OK. )
17 For additional information on file access permissions see File Access Permissions.
21 /* Detailed description: This sample code checks read-ok accessibility of file Example.c
23 * Precondtions: Example.txt file should be present in working directory.
28 if(access("Example.c" ,R_OK) < 0)
30 printf("Read operation on the file is not permitted") ;
33 printf("Read operation permitted on Example.c file") ;
40 Read operation permitted on Example.c file
46 The fn parameter should not exceed 256 characters in length.
48 KErrNotReady of Symbian error code is mapped to ENOENT, which typically means drive
49 not found or filesystem not mounted on the drive.
56 @capability Deferred @ref RFs::Entry(const TDesC16&, TEntry&)
62 /** @fn chdir(const char *_path)
65 Note: This description also covers the following functions -
68 @return Upon successful completion, the value 0 is returned; otherwise the
69 value -1 is returned and the global variable errno is set to indicate the
72 The path argument points to the pathname of a directory.
74 causes the named directory
75 to become the current working directory, that is,
76 the starting point for path searches of pathnames not beginning with a slash, ‘/.’
78 The fchdir system call causes the directory referenced by the file descriptor fd to become the current working directory, the starting point for path
79 searches of pathnames not beginning with a slash, ‘/.’
86 * Detailed description : This test code demonstrates usage of chdir system call
88 * Preconditions : "Example" directory should be present in current working
94 if(chdir("Example") < 0 )
96 printf("Failed to change working directory");
99 printf("Working directory changed");
106 Working directory changed
116 int mkdr = mkdir("test_dir", S_IWUSR);
119 int opn = open("test_dir", O_RDONLY);
122 retVal = fchdir( opn );
125 printf("Fchdir passed");
131 int cls = close(opn);
137 rmdr = rmdir("test_dir");
154 The path parameter should not exceed 256 characters in length.
155 KErrNotReady of Symbian error code is mapped to ENOENT, which typically means drive
156 not found or filesystem not mounted on the drive.
158 @capability Deferred @ref RFs::SetSessionPath(const TDesC16&)
159 @capability Deferred @ref RFs::Att(const TDesC16&, unsigned&)
162 @externallyDefinedApi
165 /** @fn chown(const char *path, uid_t owner, gid_t group)
170 Note: This description also covers the following functions -
173 @return These functions always return 0.
177 The chown and lchown functions are build supported but not available functionally.
179 Symbian OS does not support the concepts of multiple users and groups.
183 KErrNotReady of symbian error code is mapped to ENOENT, which typically means drive
184 not found or filesystem not mounted on the drive.
190 @externallyDefinedApi
193 /** @fn close(int fd)
195 @return The close() function returns the value 0 if successful; otherwise it returns
196 the value -1 and sets the global variable errno to indicate the error.
198 The close system call deletes a descriptor from the per-process object reference
199 table. If this is the last reference to the underlying object the object will
200 be deactivated. For example, on the last close of a file the current seek pointer associated with the file is lost; on the last close of a socket any file descriptor for that file is closed by that process.
202 If 'fd' refers to a shared memory object that is still referenced at the last close, the
203 contents of the memory object persists till it is unreferenced.
204 If this is the last close of the shared memory object and the close results in unreferencing of the memory
205 object and the memory object is unlinked, (only in this scenario) the memory object is removed.
207 When a process exits all associated file descriptors are freed. As there is
208 a limit on active descriptors per processes the close system call is useful when a large quantity of file descriptors
215 /* Detailed description : This test code demonstrates usage of close system call
217 * Preconditions : None.
221 #include <sys/types.h>
226 fd = open("Example.txt" , O_CREAT | O_RDWR , 0666);
229 printf("Failed to open file Example.txt");
234 printf("Failed to close file Example.txt");
237 printf("File Example.txt closed" );
244 File Example.txt closed
258 @externallyDefinedApi
261 /** @fn dup(int aFid)
264 Note: This description also covers the following functions -
267 @return The value -1 is returned if an error occurs in either call.
268 The external variable errno indicates the cause of the error.
271 duplicates an existing object descriptor and returns its value to
272 the calling process ( newd = dup (aFid, ).); The argument aFid is a small non-negative integer index in
273 the per-process descriptor table.
275 The new descriptor returned by the call
276 is the lowest numbered descriptor
277 currently not in use by the process.
279 The object referenced by the descriptor does not distinguish
280 between aFid and newd in any way.
281 Thus if newd and aFid are duplicate references to an open
282 file, read , write and lseek calls all move a single pointer into the file,
283 and append mode, non-blocking I/O and asynchronous I/O options
284 are shared between the references.
285 If a separate pointer into the file is desired, a different
286 object reference to the file must be obtained by issuing an
287 additional open system call.
289 In dup2, the value of the new descriptor newd is specified.
290 If this descriptor is already in use and oldd != newd, the descriptor is first deallocated as if the close system call had been used.
291 If aFid is not a valid descriptor, then newd is not closed.
292 If aFid == newd and aFid is a valid descriptor, then dup2 is successful, and does nothing.
297 dup2(int oldfd, int newfd);
299 The return value of dup2 can be different
300 from the one user expected to be (newfd). Users of dup2 must therefor use the
301 return value of dup2 as the new allocated fd rather than the one passed in (newfd).
302 As described above, if dup2 is successful the newfd and return values are the
308 *Detailed description : Sample usage of dup system call
318 fd = open("Example.txt" , O_CREAT | O_RDWR , 0666);
320 printf("Failed to open file Example.txt");
326 printf("Failed to duplicate file descriptor");
331 printf("New Duped fd is %d" , Newfd);
343 *Detailed description : Sample usage of dup system call
354 fd = open("Example.txt" , O_CREAT | O_RDWR , 0666);
356 printf("Failed to open file Example.txt");
359 Newfd = dup2(fd , 4);
361 printf("Failed to duplicate file descriptor");
366 printf("New Duped fd is %d" , Newfd);
388 @externallyDefinedApi
391 /** @fn dup2(int aFid1, int aFid2)
395 Refer to dup() for the documentation
408 @externallyDefinedApi
411 /** @fn fpathconf(int fd, int name)
415 Refer to pathconf() for the documentation
421 @externallyDefinedApi
424 /** @fn getcwd(char *_buf, size_t _size)
427 @return Upon successful completion a pointer to the pathname is returned. Otherwise
428 a NULL pointer is returned and the global variable errno is set to indicate the error. In addition, getwd copies the error message associated with errno into the memory referenced by buf.
430 The getcwd function copies the absolute pathname of the current working directory
431 into the memory referenced by buf and returns a pointer to buf. The size argument is the _size, in bytes, of the array referenced by buf.
433 If _buf is NULL, space is allocated as indicated by size to store the pathname and the current working directory is
434 returned as long as the _size bytes are sufficient to hold the working directory name.
435 This space may later be free’d.
437 This routine has traditionally been used by programs to save the
438 name of a working directory for the purpose of returning to it.
439 A much faster and less error-prone method of accomplishing this is to
440 open the current directory ((‘.’) and use the fchdir function to return.
451 //change directory to c:
453 long size = BUF_SIZE;
459 buf = (char *)malloc((size_t)size);
461 if (buf != NULL && c == 0)
463 //call getcwd to fetch teh current directory
464 ptr = getcwd(buf, (size_t)size);
465 printf("getcwd returned: %s", ptr);
481 returns the default working directory as c:\\private\\XXXXXXXX (where XXXXXXXX is the UID of the process) as the default session path is
482 initialised to c:\\private\\current_process'_UID, in case of Symbian OS.
491 @externallyDefinedApi
494 /** @fn getegid(void)
495 Refer to getgid() for the documentation
501 @externallyDefinedApi
504 /** @fn geteuid(void)
505 Refer to getuid() for the documentation
511 @externallyDefinedApi
517 Note: This description also covers the following functions -
520 @return These functions always return 0.
522 getgid and getegid are build supported but not available functionally. Symbian OS
523 does not support multiple users and groups.
530 @externallyDefinedApi
534 /** @fn getgroups(int size, gid_t grouplist[])
537 @return These functions always return 0.
539 The getgroups function build supported but not available functionally. Symbian
540 OS does not support multiple users and groups.
549 @externallyDefinedApi
552 /** @fn getpgrp(void)
553 Note: This description also covers the following functions -
556 @return These functions always return 0.
558 getpgrp and getpgid are build supported but not available functionally. Symbian OS
559 does not support multiple users and groups.
568 @externallyDefinedApi
573 Note: This description also covers the following functions -
576 The getpid system call returns the process ID of the calling process. Though
577 the ID is guaranteed to be unique it should NOT be used for constructing temporary file names for security reasons;
580 The getppid system call
581 returns the process ID of the parent
582 of the calling process.
587 * Detailed description : Sample usage of getpid system call
593 if((pid = getpid()) < 0 )
595 printf("getpid system call failed") ;
598 printf("pid of this process is %d " , pid) ;
608 @externallyDefinedApi
611 /** @fn getppid(void)
612 Refer to getpid() for the documentation
618 @externallyDefinedApi
622 Note: This description also covers the following functions -
625 @return These functions always return 0.
627 getuid and geteuid are build supported but not available functionally. Symbian OS
628 does not support multiple users and groups.
635 @externallyDefinedApi
638 /** @fn isatty(int fd)
640 @return The isatty returns 1 if fd is an open descriptor connected to a terminal; returns 0 otherwise.
642 This function operate on the system file descriptors for character special devices.
645 determines if the file descriptor fd refers to a valid
646 terminal type device.
652 #include<fcntl.h> //O_APPEND
656 int x = isatty(0); //stdin (fd = 0)
657 int y = isatty(1); //stdout (fd = 1)
658 int z = isatty(2); //stderr (fd = 2)
660 printf("{Expected: 1 1 1} %d %d %d", x, y, z);
662 int i = isatty(5); //some invalid fd
664 int fd_file = open("c:\some.txt", O_APPEND);
666 int j = isatty(fd_file); //valid fd of a text file
669 int p = pipe(fd_pipe);
671 int k = isatty(fd_pipe[1]); //valid fd of a pipe
677 printf("{Expected: 0 0 0} %d %d %d", i, j, k);
679 unlink("c:\some.txt");
687 {Expected: 1 1 1} 1 1 1
688 {Expected: 0 0 0} 0 0 0
697 @externallyDefinedApi
700 /** @fn link(const char *oldpath, const char *newpath)
703 @return Returns 0 on successful completion. Otherwise returns -1 and sets errno to indicate the error.
705 The link system call atomically creates the specified directory entry (hard
706 link) newpath with the attributes of the underlying object pointed at by oldpath. Note that if the link is successful the link count of the underlying
707 object is not incremented: On Symbian OS link functionality is simulated and the
708 underlying object is not aware of a existing link. Link is supported only on regular files and fifos. It is not on directories. Creation
709 of link on a existing link file is not supported.
711 If oldpath is removed, the file newpath is also deleted as the platform recognizes the underlying object only by oldpath.
713 The object pointed at by the oldpath argument must exist for the hard link to succeed and both oldpath and newpath must be in the same file system. The oldpath argument may not be a directory. Creation time stamp of the file
714 is not supported and access time stamp is equal to modification time stamp.
715 A newly created file will not alter the time stamp of parent directory.
720 * Detailed description : Example to create link to a file
721 * Precondition : "Parent.txt" should exist in c: drive
728 if(link("C:\Parent.txt","C:\Link") < 0)
730 printf("Link creation to parent file failed");
733 printf("Link to parent file created");
740 Link to parent file created.
746 - The oldpath and newpath parameters of the link() function should not exceed 256 characters in length.
747 - P.I.P.S. only simulates link files and does not distinguish between hard and symbolic links.
749 - KErrNotReady of Symbian error code is mapped to ENOENT, which typically means drive
750 not found or filesystem not mounted on the drive.
758 @capability Deferred @ref RFs::Delete(const TDesC16&)
761 @externallyDefinedApi
764 /** @fn lseek(int fd, off_t pos, int whence)
768 @return Upon successful completion, lseek returns the resulting offset location as measured in bytes from the beginning of the file. Otherwise, a value of -1 is returned and errno is set to indicate the error.
770 The lseek system call repositions the offset of the file descriptor fildes to the argument offset according to the directive whence. The argument fildes must be an open file descriptor. The lseek system call repositions the file position pointer associated with the file descriptor fildes as follows:
771 If whence is SEEK_SET, the offset is set to offset bytes.
772 If whence is SEEK_CUR, the offset is set to its current location plus offset bytes.
773 If whence is SEEK_END, the offset is set to the size of the file plus offset bytes.
774 Some devices are incapable of seeking. The value of the pointer associated with such a device is undefined.
776 If 'fd' refers to a shared memory object then lseek() on the shared memory object is supported by the current implementation.
778 Note : lseek function allows the file offset to be set beyond the existing end-of-file, data in the seeked slot is undefined, and hence the read operation in seeked slot is undefined untill data is actually written into it. lseek beyond existing end-of-file increases the file size accordingly.
782 The lseek system call will fail and the file position pointer will remain unchanged if:
783 [EBADF] The fildes argument is not an open file descriptor.
784 [EINVAL] The whence argument is not a proper value or the resulting file offset would be negative for a non-character special file.
785 [EOVERFLOW] The resulting file offset would be a value which cannot be represented correctly in an object of type off_t(Not supported).
786 [ESPIPE] The fildes argument is associated with a pipe, socket, or FIFO.
791 * Detailed description : Example for lseek usage.
794 #include <sys/stat.h>
796 #include <sys/types.h>
800 fd = open("lseek.txt" , O_CREAT | O_RDWR , 0666);
801 if(lseek(fd , 0 , SEEK_SET) < 0 ) {
802 printf("Lseek on file lseek.txt failed \n");
805 printf("Lseek on lseek.txt passed ");
812 Lseek on lseek.txt passed
821 @externallyDefinedApi
824 /** @fn lseek64(int fildes, off64_t offset, int whence)
828 @return Upon successful completion, lseek64 returns the resulting offset location as measured in bytes from the
829 beginning of the file.
831 a value of -1 is returned and errno is set to indicate
834 For full documentation see: http://www.unix.org/version2/whatsnew/lfs20mar.html#3.0
840 @externallyDefinedApi
843 /** @fn pathconf(const char *path, int name)
847 Note: This description also covers the following functions -
850 @return If the call to pathconf or fpathconf is not successful, -1 is returned and errno is set appropriately.
851 Otherwise, if the variable is associated with functionality that does
852 not have a limit in the system, -1 is returned and errno is not modified.
853 Otherwise, the current variable value is returned.
855 The pathconf and fpathconf system calls provide a method for applications to determine the current
856 value of a configurable system limit or option variable associated
857 with a pathname or file descriptor.
859 For pathconf, the path argument is the name of a file or directory.
860 For fpathconf, the fd argument is an open file descriptor.
861 The name argument specifies the system variable to be queried.
862 Symbolic constants for each name value are found in the include file \<unistd.h\>.
864 The available values are as follows:
867 The maximum file link count.
869 The maximum number of bytes in terminal canonical input line.
871 The minimum maximum number of bytes for which space is available in a terminal input queue.
873 The maximum number of bytes in a file name.
875 The maximum number of bytes in a pathname.
877 The maximum number of bytes which will be written atomically to a pipe.
879 Return 1 if appropriate privilege is required for the chown system call, otherwise 0. -p1003.1-2001 requires appropriate privilege in all cases, but this behavior was optional in prior editions of the standard.
881 Return greater than zero if attempts to use pathname components longer than
882 .Brq Dv NAME_MAX will result in an [ENAMETOOLONG] error; otherwise, such components will be truncated to
883 .Brq Dv NAME_MAX. -p1003.1-2001 requires the error in all cases, but this behavior was optional in prior editions of the standard, and some non- POSIX -compliant file systems do not support this behavior.
885 Returns the terminal character disabling value.
887 Return 1 if asynchronous I/O is supported, otherwise 0.
889 Returns 1 if prioritised I/O is supported for this file, otherwise 0.
891 Returns 1 if synchronised I/O is supported for this file, otherwise 0.
893 Minimum number of bytes of storage allocated for any portion of a file.
895 Number of bits needed to represent the maximum file size.
896 _PC_REC_INCR_XFER_SIZE
897 Recommended increment for file transfer sizes between _PC_REC_MIN_XFER_SIZE and _PC_REC_MAX_XFER_SIZE.
898 _PC_REC_MAX_XFER_SIZE
899 Maximum recommended file transfer size.
900 _PC_REC_MIN_XFER_SIZE
901 Minimum recommended file transfer size.
903 Recommended file transfer buffer alignment.
905 Maximum number of bytes in a symbolic link.
907 Returns 1 if an Access Control List (ACL) can be set on the specified file, otherwise 0.
909 Maximum number of ACL entries per file.
911 Returns 1 if a capability state can be set on the specified file, otherwise 0.
913 Returns 1 if an information label can be set on the specified file, otherwise 0.
915 Returns 1 if a Mandatory Access Control (MAC) label can be set on the specified file, otherwise 0.
920 If any of the following conditions occur, the pathconf and fpathconf system calls shall return -1 and set errno to the corresponding value.
921 [EINVAL] The value of the name argument is invalid.
922 [EINVAL] The implementation does not support an association of the variable name with the associated file.
923 The pathconf system call will fail if:
924 [ENOTDIR] A component of the path prefix is not a directory.
925 [ENAMETOOLONG] A component of a pathname exceeded
926 .Brq Dv NAME_MAX characters (but see _PC_NO_TRUNC above), or an entire path name exceeded
927 .Brq Dv PATH_MAX characters.
928 [ENOENT] The named file does not exist.
929 [EACCES] Search permission is denied for a component of the path prefix.
930 [ELOOP] Too many symbolic links were encountered in translating the pathname.
931 [EIO] An I/O error occurred while reading from or writing to the file system.
932 The fpathconf system call will fail if:
933 [EBADF] The fd argument is not a valid open file descriptor.
934 [EIO] An I/O error occurred while reading from or writing to the file system.
942 int fp = open("test_pathconf1.txt", O_RDWR|O_CREAT);
945 int n = pathconf("test_pathconf1.txt", _PC_LINK_MAX);
946 if( n < _POSIX_LINK_MAX )
952 printf("_PC_LINK_MAX value: %d", n);
953 printf("Pathconf passed");
967 _PC_LINK_MAX value: 1
976 The current implementation of the functions pathconf and fpathconf considers only the following configurable variables. _PC_LINK_MAX _PC_MAX_CANON _PC_MAX_INPUT _PC_NAME_MAX _PC_PATH_MAX _PC_PIPE_BUF _PC_CHOWN_RESTRICTED _PC_NO_TRUNC _PC_VDISABLE Also, these functions return the limits as required by the POSIX
977 standard instead of the actual system limits determined on the run.
983 @externallyDefinedApi
986 /** @fn pipe(int *fildes)
988 @return The pipe function returns the value 0 if successful; otherwise the
989 value -1 is returned and errno is set to indicate the error.
992 creates a pipe, which is an object allowing
993 bidirectional data flow,
994 and allocates a pair of file descriptors.
996 By convention, the first descriptor is normally used as the read end of the pipe, and the second is normally the write end, so that data written to fildes[1] appears on (i.e. can be read from) fildes[0]. This allows the output of one thread to be sent to another
997 thread: the source's standard output is set up to be the write end of the
998 pipe and the sink's standard input is set up to be the read end of the
999 pipe. The pipe itself persists until all its associated descriptors are closed.
1001 A pipe that has had an end closed is considered widowed. Writing on such a pipe causes the writing process to fail and errno is set to EPIPE . Widowing a pipe is the only way to deliver end-of-file to a
1002 reader: After the reader consumes any buffered data, reading a widowed pipe
1003 returns a zero count.
1013 if (pipe(fds) == -1) {
1014 printf("Pipe creation failed");
1016 /* fds[0] - opened for read */
1017 /* fds[1] - opened for write */
1031 @externallyDefinedApi
1034 /** @fn read(int fd, void *buf, size_t cnt)
1039 Note: This description also covers the following functions -
1042 @return If successful, the number of bytes actually read is returned. Upon reading
1043 end-of-file, zero is returned. Otherwise, -1 is returned and the global variable errno is set to indicate the error.
1045 The read system call
1046 attempts to read cnt bytes of data from the object referenced by the descriptor fd into the buffer pointed to by buf. The readv system call
1047 performs the same action, but scatters the input data
1048 into the iovcnt buffers specified by the members of the iov array: iov[0], iov[1], ..., iov[iovcnt-1].
1050 For readv the iovec structure is defined as:
1053 void *iov_base; // Base address.
1054 size_t iov_len; // Length.
1057 Each iovec entry specifies the base address and length of an area
1058 in memory where data should be placed.
1059 The readv system call
1060 will always fill an area completely before proceeding
1063 On objects capable of seeking, the read starts at a position
1064 given by the pointer associated with fd (see lseek )
1065 Upon return from read, the pointer is incremented by the number of bytes actually read.
1067 If 'fd' refers to a shared memory object then read() on the shared memory object is supported by the current implementation.
1069 Objects that are not capable of seeking always read from the current
1071 The value of the pointer associated with such an
1072 object is undefined.
1074 Upon successful completion, read, and readv return the number of bytes actually read and placed in the buffer.
1075 The system guarantees to read the number of bytes requested if
1076 the descriptor references a normal file that has that many bytes left
1077 before the end-of-file, but in no other case.
1081 The read, and readv system calls will succeed unless:
1082 [EBADF] The d argument is not a valid file or socket descriptor open for reading.
1083 [ECONNRESET]The d argument refers to a socket, and the remote socket end is forcibly closed.
1084 [EFAULT] The buf argument points outside the allocated address space(Not supported).
1085 [EIO] An I/O error occurred while reading from the file system(Not supported).
1086 [EINTR] A read from a slow device was interrupted before any data arrived by the delivery of a signal(Not supported).
1087 [EINVAL] The pointer associated with d was negative.
1088 [EAGAIN] The file was marked for non-blocking I/O, and no data were ready to be read.
1089 [EISDIR] The file descriptor is associated with a directory residing on a file system that does not allow regular read operations on directories (e.g. NFS)(Not supported).
1090 [EOPNOTSUPP] The file descriptor is associated with a file system and file type that do not allow regular read operations on it(Not supported).
1091 [EOVERFLOW] The file descriptor is associated with a regular file, nbytes is greater than 0, offset is before the end-of-file, and offset is greater than or equal to the offset maximum established for this file system(Not supported).
1092 [EINVAL] The value nbytes is greater than INT_MAX.
1093 In addition, readv and preadv may return one of the following errors:
1094 [EINVAL] The iovcnt argument was less than or equal to 0, or greater than IOV_MAX.
1095 [EINVAL] One of the iov_len values in the iov array was negative.
1096 [EINVAL] The sum of the iov_len values in the iov array overflowed a 32-bit integer.
1097 [EFAULT] Part of the iov array points outside the process’s allocated address space.
1101 /* Detailed description :This example demonstrates usage of read-system call, this
1102 * Example reads 10 bytes from a file specified
1104 * Preconditions: Example.txt file should be present in C: and should contain
1105 * string Hello World.
1109 #include <sys/types.h>
1110 #include <sys/stat.h>
1115 char Buff[12] = {0};
1117 fd = open("C:\Example.txt" , O_RDONLY );
1120 printf("Failed to open C:\Example.txt file");
1124 if(read(fd , Buff , 11) < 11) {
1125 printf("Failed to read specified number of bytes from file");
1129 printf("file contains %s
1137 file contains Hello World
1142 * Detailed description: Sample usage of readv system call
1143 * Preconditions: Example.txt file should be present in working directory containing Hello world in it
1147 #include <sys/types.h>
1148 #include <sys/uio.h>
1153 struct iovec io_vec[1];
1154 char Buf[12] = { 0 };
1155 io_vec[0].iov_base = Buf;
1156 io_vec[0].iov_len = 11;
1157 fd = open("Example.txt" , O_RDONLY );
1159 printf("File open failed");
1162 if(readv(fd , io_vec , 1) < 11 ) {
1163 printf("Failed to read fron Example.txt file");
1166 printf("Read succes %s" , io_vec[0].iov_base);
1173 Read succes Hello World
1178 @see getdirentries()
1191 @externallyDefinedApi
1194 /** @fn rmdir(const char *_path)
1196 @return The rmdir() function returns the value 0 if successful; otherwise the
1197 value -1 is returned and the global variable errno is set to indicate the
1200 The rmdir system call removes a directory file whose name is given by path.
1201 The directory must not have any entries other than '.' and '..'.
1205 * Detailed description: This test code demonstrates usage of rmdir systemcall, it removes directory
1206 * Example from the current working directory.
1208 * Preconditions: Expects empty directory "Example" in current working directory.
1213 if(rmdir("Example") < 0 )
1215 printf("Rmdir failed");
1218 printf("Directory Example removed");
1224 Directory Example removed
1231 The _path parameter of the rmdir() function should not exceed 256 characters in length.
1233 KErrNotReady of Symbian error code is mapped to ENOENT, which typically means drive
1234 not found or filesystem not mounted on the drive.
1236 @capability Deferred @ref RFs::RmDir(const TDesC16&)
1237 @capability Deferred @ref RFs::Att(const TDesC16&, unsigned&)
1240 @externallyDefinedApi
1243 /** @fn setgid(gid_t gid)
1246 Refer to setuid() for the documentation
1252 @externallyDefinedApi
1255 /** @fn setpgid(pid_t pid, pid_t pgid)
1259 Note: This description also covers the following functions -
1262 @return These functions always return 0.
1264 These functions are build supported but not available functionally. Symbian
1265 OS does not support multiple users and groups.
1272 @externallyDefinedApi
1275 /** @fn setsid(void)
1277 @return These functions always return 0.
1279 These functions are build supported but not available functionally. Symbian
1280 OS does not support multiple users and groups.
1287 @externallyDefinedApi
1290 /** @fn setuid(uid_t uid)
1293 Note: This description also covers the following functions -
1294 seteuid() setgid() setegid()
1296 @return These functions always return 0.
1298 These functions are build supported but not available functionally. Symbian
1299 OS does not support multiple users and groups.
1306 @externallyDefinedApi
1309 /** @fn sleep(unsigned int secs)
1311 @return If the sleep function returns because the requested time has elapsed, the value
1312 returned will be zero.
1314 The sleep function suspends execution of the calling process until seconds seconds have elapse
1316 Time interval is internally represented using 32 bit value(range +-2147483647).
1317 Any time interval greater 2147483647 returns 0 without sleeping. Hence Maximum
1318 sleep time supported here is 35 minutes, 47 seconds.
1325 * Detailed description: This test code shows usage of sleep system call , here sample code
1326 * sleeps for 2 seconds.
1333 printf("Sleep failed");
1336 printf("Sleep successful");
1352 @externallyDefinedApi
1355 /** @fn sysconf(int name)
1357 @return If the call to sysconf is not successful, -1 is returned and errno is set appropriately.
1358 Otherwise, if the variable is associated with functionality that is not
1359 supported, -1 is returned and errno is not modified.
1360 Otherwise, the current variable value is returned.
1362 This interface is defined by -p1003.1-88 .A far more complete interface is available using sysctl.
1365 The sysconf function provides a method for applications to determine the
1366 current value of a configurable system limit or option variable. The name argument specifies the system variable to be queried. Symbolic
1367 constants for each name value are found in the include file \#include \<unistd.h\> . Shell programmers who need access
1368 to these parameters should use the getconf utility.
1370 The available values are as follows:
1373 The maximum number of argument to execve.
1375 The maximum number of simultaneous processes per user id.(Not supported)
1377 The frequency of the statistics clock in ticks per second.
1379 The maximum number of elements in the I/O vector used by readv , writev , recvmsg ,
1382 The maximum number of supplemental groups.(Not supported)
1383 _SC_NPROCESSORS_CONF
1384 The number of processors configured.(Not supported)
1385 _SC_NPROCESSORS_ONLN
1386 The number of processors currently online.(Not supported)
1388 The maximum number of open files per user id.(Not supported)
1390 The minimum maximum number of streams that a process may have open( Not supported)
1393 The minimum maximum number of types supported for the name of a
1394 timezone.(Not supported)
1396 Return 1 if job control is available on this system, otherwise -1.
1398 Returns 1 if saved set-group and saved set-user ID is available,
1399 otherwise -1.(Not supported)
1401 The version of -p1003.1 with which the system
1402 attempts to comply.(Not supported)
1404 The maximum ibase/obase values in the bc utility.(Not supported)
1406 The maximum array size in the bc utility.(Not supported)
1408 The maximum scale value in the bc utility.(Not supported)
1410 The maximum string length in the bc utility.(Not supported)
1411 _SC_COLL_WEIGHTS_MAX
1412 The maximum number of weights that can be assigned to any entry of
1413 the LC_COLLATE order keyword in the locale definition file.(Not supported)
1415 The maximum number of expressions that can be nested within
1416 parenthesis by the expr utility.(Not supported)
1418 The maximum length in bytes of a text-processing utility's input
1419 line.(Not supported)
1421 The maximum number of repeated occurrences of a regular expression
1422 permitted when using interval notation.(Not supported)
1424 The version of -p1003.2 with which the system attempts to comply.( Not supported)
1426 Return 1 if the system's C-language development facilities support the
1427 C-Language Bindings Option, otherwise -1.
1429 Return 1 if the system supports the C-Language Development Utilities Option,
1432 Return 1 if the system supports at least one terminal type capable of
1433 all operations described in -p1003.2 ,
1436 Return 1 if the system supports the FORTRAN Development Utilities Option,
1439 Return 1 if the system supports the FORTRAN Runtime Utilities Option,
1442 Return 1 if the system supports the creation of locales, otherwise -1.
1444 Return 1 if the system supports the Software Development Utilities Option,
1447 Return 1 if the system supports the User Portability Utilities Option,
1450 Returns size of a page in bytes. (Some systems use PAGE_SIZE instead.)
1453 Note: Some of the return values may not be posix compliant.
1458 * Detailed description : This test code demonstrates usage of sysconf system call , here it get max command
1459 line arguments that can be passed to process.
1465 ret = sysconf(_SC_ARG_MAX) ;
1467 printf("Sysconf call failed") ;
1470 printf("Max command line arguments = %d" , ret) ;
1477 max-number of commandline args supproted by system.
1486 The value for _SC_STREAM_MAX is a minimum maximum, and is required to be
1487 the same as ANSI C's FOPEN_MAX, so the returned value is a ridiculously small
1488 and misleading number.
1493 @externallyDefinedApi
1496 /** @fn unlink(const char *pathname)
1498 @return Upon successful completion, 0 is returned. Otherwise, -1 is returned and errno is set to indicate the error.
1501 The unlink system call removes the link named by pathname from its file system.
1503 Symbian OS simulates links so there is no reference count and files are unaware
1504 of links. Calling unlink on a file will always close the file, regardless of
1505 whether there is another link.
1507 The pathname argument may not be a directory.
1512 * Detailed description : Example to unlink a link file
1513 * Precondition : A link file by name "Link" should exist in
1521 if(unlink("C:\Link"))
1523 printf("unlink on link file failed");
1525 printf("Unlink on link file succeeded");
1531 Unlink on link file succeeded.
1537 - The path parameter of the unlink() function should not exceed 256 characters in length.
1538 - P.I.P.S. only simulates link files and does not distinguish between hard and symbolic links.
1539 - KErrNotReady of Symbian error code is mapped to ENOENT, which typically means drive
1540 not found or filesystem not mounted on the drive.
1549 @capability Deferred @ref RFs::Att(const TDesC16&, unsigned&)
1550 @capability Deferred @ref RFs::SetAtt(const TDesC16&, unsigned, unsigned)
1551 @capability Deferred @ref RFs::Delete(const TDesC16&)
1554 @externallyDefinedApi
1557 /** @fn write(int fd, const void *buf, size_t cnt)
1562 @return Upon successful completion the number of bytes which were written
1564 Otherwise a -1 is returned and the global variable errno is set to indicate the error.
1566 The write system call attempts to write cnt bytes of data to the object referenced by the descriptor fd from the buffer pointed to by buf .
1567 The writev system call performs the same action, but gathers the output data from the iovcnt buffers specified by the members of the iov array: iov[0], iov[1], ..., iov[iovcnt-1].
1568 The pwrite and pwritev system calls perform the same functions, but write to the specified position in the file without modifying the file pointer.
1572 1. This description also covers the pwrite(), writev() and pwritev() functions.
1574 2. An attempt to write on a broken pipe generates the SIGPIPE signal, which may cause termination of the process, if it is not handled.
1576 For writev and pwritev, the iovec structure is defined as:
1580 void *iov_base; //Base address.
1581 size_t iov_len; // Length.
1585 Each iovec entry specifies the base address and length of an area
1586 in memory from which data should be written.
1587 The writev system call
1588 will always write a complete area before proceeding
1591 On objects capable of seeking, the write starts at a position
1592 given by the pointer associated with fd ,
1594 Upon return from write ,
1595 the pointer is incremented by the number of bytes which were written.
1597 If 'fd' refers to a shared memory object then write() on the shared memory object is supported by the current implementation.
1599 Objects that are not capable of seeking always write from the current
1601 The value of the pointer associated with such an object
1604 When using non-blocking I/O on objects such as sockets that are subject
1605 to flow control, write and writev may write fewer bytes than requested;
1606 the return value must be noted,
1607 and the remainder of the operation should be retried when possible.
1611 /* Detailed description: This sample code creates an Example.txt file in the current working
1612 * directory(if file existes then it is truncated) and writes "Hello World" string
1615 * Preconditions: Example.txt if present, it should not be read-only.
1620 char Buf[] = "Hello World" ;
1621 fd = open("Example.txt" , O_CREAT | O_TRUNC | O_RDWR ,0666) ;
1624 printf("Failed to open file Example.txt") ;
1627 if(write(fd , Buf , sizeof(Buf)) < sizeof(Buf))
1629 printf("Failed to write string %s to file" , Buf) ;
1632 printf("String %s written to file
1640 String Hello World written to file
1645 * Detailed description : Sample usage of readv system call
1648 #include <sys/types.h>
1649 #include <sys/uio.h>
1654 struct iovec io_vec[1] ;
1655 char Buf[12] = "Hello world" ;
1656 io_vec[0].iov_base = Buf ;
1657 io_vec[0].iov_len = 11 ;
1658 fd = open("Example.txt" , O_CREAT | O_RDWR , 0666 ) ;
1660 printf("File open failed") ;
1663 if(writev(fd , io_vec , 1) < 11 ) {
1664 printf("Failed to read fron Example.txt file") ;
1667 printf("writev succes %s written" , io_vec[0].iov_base) ;
1673 writev succes Hello world written
1686 @externallyDefinedApi
1689 /** @fn confstr(int name, char *buf, size_t len)
1693 @return If the call to confstr is not successful, 0 is returned and errno is set appropriately.
1694 Otherwise, if the variable does not have a configuration defined value,
1695 0 is returned and errno is not modified.
1696 Otherwise, the buffer size needed to hold the entire configuration-defined
1698 If this size is greater than the argument len, the string in buf was truncated.
1700 The confstr function provides a method for applications to get configuration
1701 defined string values.
1703 The name argument specifies the system variable to be queried. Symbolic
1704 constants for each name value are found in the include file \#include \<unistd.h.\> The len argument specifies the size of the buffer referenced by the argument buf. If len is non-zero, buf is a non-null pointer, and name has a value, up to len - 1 bytes of the value are copied into the buffer buf. The copied value is always null terminated.
1705 The available values are as follows:
1709 Return a value for the PATH environment variable that finds all the standard utilities.
1725 n = confstr(_CS_PATH, NULL, 0);
1727 printf("{Expected: 31} %d", n);
1732 buf = (char *)malloc(n);
1736 printf("malloc failed!!");
1740 len = confstr(_CS_PATH, buf, n);
1742 printf("PATH in buffer: \n%s", buf);
1743 printf("length: %d", len);
1753 /usr/bin:/bin:/usr/sbin:/sbin:
1764 @externallyDefinedApi
1767 /** @fn getopt(int nargc, char * const nargv[], const char *ostr)
1771 @return The getopt function returns the next known option character in optstring. If getopt encounters a character not found in optstring or if it detects a missing option argument, it returns ‘?’ (question mark. If optstring has a leading ‘:’ then a missing option argument causes ‘:’ to be returned instead of ‘?.’ In either case, the variable optopt is set to the character that caused the error. The getopt function returns -1 when the argument list is exhausted.
1773 The getopt function incrementally parses a command line argument list argv and returns the next known option character. An option character is known if it has been specified in the string of accepted option characters, optstring.
1775 The option string optstring may contain the following elements: individual characters, and characters followed by a colon to indicate an option argument is to follow. For example, an option string x recognizes an option "-x", and an option string x: recognizes an option and argument "-x argument." It does not matter to getopt if a following argument has leading white space.
1777 On return from getopt, optarg points to an option argument, if it is anticipated, and the variable optind contains the index to the next argv argument for a subsequent call to getopt. The variable optopt saves the last known option character returned by getopt.
1779 The variables opterr and optind are both initialized to 1. The optind variable may be set to another value before a set of calls to getopt in order to skip over more or less argv entries.
1781 In order to use getopt to evaluate multiple sets of arguments, or to evaluate a single set of arguments multiple times, the variable optreset must be set to 1 before the second and each additional set of calls to getopt, and the variable optind must be reinitialized.
1783 The getopt function returns -1 when the argument list is exhausted. The interpretation of options in the argument list may be cancelled by the option ‘--’ (double dash) which causes getopt to signal the end of argument processing and return -1. When all options have been processed (i.e., up to the first non-option argument), getopt returns -1.
1805 while ((ch = getopt(argc, argv, "bf:")) != -1) {
1810 printf("option is 'b' \n");
1813 printf("option is 'f' \n");
1814 if ((fd = open(optarg, O_RDONLY, 0)) != 0) {
1815 (void)fprintf(stderr,
1816 "myname: %s: %s\n", optarg, strerror(errno));
1820 printf("missing option!");
1822 printf("unknown option!");
1834 myname: hi: No such file or directory
1840 The getopt function was once specified to return EOF instead of -1. This was changed by -p1003.2-92 to decouple getopt from
1841 \#include \<stdio.h\>
1843 A single dash "-" may be specified as a character in optstring, however it should never have an argument associated with it. This allows getopt to be used with programs that expect "-" as an option flag. This practice is wrong, and should not be used in any current development. It is provided for backward compatibility only. Care should be taken not to use ‘-’ as the first character in optstring to avoid a semantic conflict with GNU getopt, which assigns different meaning to an optstring that begins with a ‘-.’ By default, a single dash causes getopt to return -1.
1845 It is also possible to handle digits as option letters. This allows getopt to be used with programs that expect a number ("-3") as an option. This practice is wrong, and should not be used in any current development. It is provided for backward compatibility only. The following code fragment works in most cases.
1851 while ((ch = getopt(argc, argv, "0123456789")) != -1)
1853 case ’0’: case ’1’: case ’2’: case ’3’: case ’4’:
1854 case ’5’: case ’6’: case ’7’: case ’8’: case ’9’:
1855 p = argv[optind - 1];
1856 if (p[0] == ’-’ Am]Am] p[1] == ch Am]Am] !p[2]) {
1859 } else if (argv[optind] Am]Am] argv[optind][1] == ch) {
1860 length = strtol((p = argv[optind] + 1),
1867 errx(EX_USAGE, "illegal number -- %s", p);
1875 @externallyDefinedApi
1878 /** @fn fsync(int fd)
1880 @return Upon successful completion, fsync() returns 0. Otherwise, it returns -1 and sets
1881 errno to indicate the error. If the fsync() function fails, outstanding I/O operations
1882 are not guaranteed to have been completed.
1884 The fsync system call
1885 causes all modified data and attributes of fd to be moved to a permanent storage device.
1886 This normally results in all in-core modified copies
1887 of buffers for the associated file to be written to a disk.
1889 The fsync system call should be used by programs that require a file to
1890 be in a known state, for example, when building a simple transaction facility.
1895 * Detailed description : Simple usage of fsync system call.
1896 * Preconditions : Example.txt if present should not a ready-only file
1903 fd = open("Example.txt" , O_CREAT | O_RDWR , 0666);
1906 printf("Failed to open file Example.txt");
1911 printf("fsync system call failed");
1915 printf("fsync system call succeeded");
1922 fsync system call succeeded
1932 @externallyDefinedApi
1935 /** @fn fdatasync(int filedesc)
1937 @return If successful the function returns 0, otherwise it returns (-1) and sets errno
1938 to indicate the error.
1940 The fdatasync system call
1941 causes all modified data and attributes of fd to be moved to a permanent storage device.
1942 This normally results in all in-core modified copies
1943 of buffers for the associated file to be written to a disk.
1944 The fdatasync() function forces all the queued I/O operations associated that
1945 file, as indicated by the file descriptor fd, to the synchronized I/O completion
1948 The functionality shall be equivalent to fsync() with the symbol _POSIX_SYNCHRONIZED_IO
1949 defined. This has an exception that all I/O operations shall be completed before
1954 The fdatasync should be used by programs that require a file to be in
1955 a known state, for example when building a simple transaction facility.
1963 #define KMAXCHARS 100
1964 int test_fdatasync()
1966 char* array = "abcdefghijklmnopqrstuvwxyz";
1968 if((fd = open(file , O_CREAT | O_RDWR , 0666)) < 0)
1970 printf("Failed to create file");
1972 size_t size = write(fd,array, KMAXCHARS);
1973 if(fdatasync(fd) < 0)
1975 printf("Fdatasync failed");
1976 int retrn = remove(file);
1979 int retVal2 = fstat( fp, &buf; );
1982 size_t bufsize = buf.st_size;
1983 if (bufsize == size)
1985 printf("file size = %d", size);
1986 printf("Fdatasync passed");
1987 int retrn = remove(file);
2007 @externallyDefinedApi
2010 /** @fn ftruncate(int filedesc, off_t length)
2014 Refer to truncate() for documentation
2018 @externallyDefinedApi
2021 /** @fn ftruncate64(int filedesc, off64_t length)
2025 For full documentation see: http://www.unix.org/version2/whatsnew/lfs20mar.html#3.0
2030 @externallyDefinedApi
2033 /** @fn readlink(const char *path, char *buf, int bufsize)
2037 @return The call returns the count of characters placed in the buffer
2038 if it succeeds, or a -1 if an error occurs, placing the error
2039 code in the global variable errno.
2041 The readlink system call
2042 places the contents of the symbolic link path in the buffer buf, which has size bufsize. The readlink system call does not append a NULL character to buf.
2047 * Detailed description: Example to read a link file
2048 * Precondition: "Parent.txt" should exist in c: drive with some contents
2049 * of length atleast 25 characters. And a link file by name
2050 * "C:\Link" pointing to parent file should exist.
2059 if((retval = (readlink("C:\Link", rdbuff, (sizeof(char)*25)))) < 0)
2061 printf("Read through link file failed");
2065 printf("Read through link file succeeded");
2071 Read through link file succeeded.
2077 The path parameter of the readlink() function should not exceed 256 characters in length.
2086 @capability Deferred @ref RFs::Entry(const TDesC16&, TEntry&)
2089 @externallyDefinedApi
2092 /** @fn gethostname(char *name, size_t size)
2095 @return On successful completion, 0 is returned. Otherwise, -1 is returned
2097 The gethostname() function returns the standard host name for the current machine. The size argument specifies the size of the array pointed to by the name argument. The returned name is null-terminated, except that if size is an insufficient length to hold the host name, then the returned name is truncated and it is unspecified whether the returned name is null-terminated.
2098 Host names are limited to 255 bytes
2103 @externallyDefinedApi
2106 /** @fn setegid(gid_t gid)
2109 Refer to setuid() for the documentation
2115 @externallyDefinedApi
2118 /** @fn seteuid(uid_t uid)
2121 Refer to setuid() for the documentation
2127 @externallyDefinedApi
2130 /** @fn symlink(const char *oldpath, const char *newpath)
2133 @return Upon successful completion, 0 is returned. Otherwise, -1 is returned and errno set to indicate the error.
2137 A symbolic link newpath is created to oldpath (newpath is the name of the file created, oldpath is the string used in creating the symbolic link). Either name
2138 may be an arbitrary path name.
2140 The creation time stamp is not supported, only access and modification time
2141 stamps. Creating a link in a directory will not alter the time stamps of the
2149 * Detailed description : Example to create symlink to a file.
2150 * Precondition : "Parent.txt" should exist in c: drive.
2151 * Remarks : Symlink behaviour is exactly similar to link api.
2157 if(symlink("C:\Parent.txt","C:\Link") < 0)
2159 printf("simulated link creation to parent file failed");
2162 printf("simulated link to parent file created");
2169 simulated link to parent file created.
2175 - The oldpath and newpath parameters of the symlink() function should not exceed 256 characters in length.
2176 - P.I.P.S. does not support links across file systems.
2177 - P.I.P.S. does not support symlink on directories or existing link files.
2178 - P.I.P.S. only simulates link files and does not distinguish between hard and symbolic links so link() and symlink() on P.I.P.S. are identical.
2179 - KErrNotReady of Symbian error code is mapped to ENOENT, which typically means drive
2180 not found or filesystem not mounted on the drive.
2190 @capability Deferred @ref RFs::Delete(const TDesC16&)
2193 @externallyDefinedApi
2196 /** @fn fchdir(int filedesc)
2199 Refer to chdir() for the documentation
2203 @capability Deferred @ref RFs::SetSessionPath(const TDesC16&)
2206 @externallyDefinedApi
2209 /** @fn getpgid(pid_t pid)
2212 Refer to getpgrp() for the documentation
2218 @externallyDefinedApi
2221 /** @fn lchown(const char *path, uid_t owner, gid_t group)
2226 Refer to chown() for the documentation
2232 @externallyDefinedApi
2235 /** @fn nice(int incr)
2239 The nice function obtains the scheduling priority of the process from
2240 the system and sets it to the priority value specified in incr. The priority is a value in the range -20 to 20. The default priority
2241 is 0. Lower priorities cause more favorable scheduling.
2254 int ret_get1 = getpriority(PRIO_PROCESS,0);
2256 int ret_get2 = getpriority(PRIO_PROCESS,0);
2257 if((retVal == -1)&&(errno))
2264 if(!(i - (ret_get2 - retget1)))
2265 printf("Nice value: %d", i)
2266 printf("nice passed");
2284 @externallyDefinedApi
2287 /** @fn setpgrp(pid_t _pid, pid_t _pgrp)
2291 Refer to setpgid() for the documentation
2297 @externallyDefinedApi
2300 /** @fn setregid(gid_t rgid, gid_t egid)
2303 @return These functions always return 0.
2305 These functions are build supported but not available functionally. Symbian
2306 OS does not support multiple users and groups.
2313 @externallyDefinedApi
2316 /** @fn setreuid(uid_t ruid, uid_t euid)
2319 @return These functions always return 0.
2321 These functions are build supported but not available functionally. Symbian
2322 OS does not support multiple users and groups.
2329 @externallyDefinedApi
2332 /** @fn swab(const void *from, void *to, ssize_t len)
2337 The function swab copies len bytes from the location referenced by from to the location referenced by to, swapping adjacent bytes.
2339 The argument len must be an even number.
2347 int i=0x00003366,j=0x0;
2348 swab((void *)&i,(void *)&j,2);
2350 printf("Ouput val = %#x\n",j);
2365 @externallyDefinedApi
2368 /** @fn usleep(useconds_t microseconds)
2370 @return The usleep function returns the value 0 if successful; otherwise the value -1 is
2371 returned and the global variable errno is set to indicate the error.
2373 The usleep function suspends execution of the calling process until either microseconds microseconds have elapsed or a signal is delivered to the process and its
2374 action is to invoke a signal-catching function or to terminate the
2376 System activity may lengthen the sleep by an indeterminate amount.
2378 This function is implemented using nanosleep by pausing for microseconds microseconds or until a signal occurs.
2379 Consequently, in this implementation,
2380 sleeping has no effect on the state of process timers,
2381 and there is no special handling for SIGALRM.
2385 The signal related functionaities aren’t applicable to the symbian implementation as there is no support for signals from symbian.
2394 unsigned long t = 2;
2398 printf("Expected: 0 usleep returned: %d", i);
2406 Expected: 0 usleep returned: 0
2416 @externallyDefinedApi
2419 /** @fn truncate(const char *file, off_t length)
2422 @return Upon successful completion, both truncate() and ftruncate() shall return 0; otherwise, -1 shall be returned and errno set to indicate the error.
2425 The truncate system call causes the file named by file or referenced by filedesc to be truncated to length bytes in size. If the file was larger than this size, the extra data is lost. If the file was smaller than this size, it will be extended as if by writing bytes with the value zero. With ftruncate, the file must be open for writing.
2429 //example for truncate
2432 #include <sys/stat.h>
2435 int retVal, retVal2, retSize, retSize2;
2438 char *buffer = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwx";
2439 int fp = open("c:\test.txt", O_RDWR|O_CREAT);
2440 size = write(fp,buffer,50);
2442 retVal2 = stat("c:\test.txt", &buf );
2445 retSize = buf.st_size;
2446 printf("Size before: %d", retSize);
2447 retVal = truncate("c:\test.txt", retSize/2 );
2453 retVal2 = stat( "c:\test.txt", &buf );
2456 retSize2 = buf.st_size;
2457 if( retSize2 == (retSize/2 ) )
2459 printf("\nSize after: %d\n", retSize2);
2460 printf("Truncate passed");
2485 The truncate and ftruncate succeed unless:
2486 [EBADF] The filedesc argument is not a valid descriptor for a regular file.
2487 [EINVAL] The filedesc argument references to an object other than a file.
2488 [EINVAL] The filedesc descriptor is not open for writing.
2493 These calls should be generalized to allow ranges of bytes in a file to be discarded.
2494 Use of truncate to extend a file is not portable.
2500 @externallyDefinedApi
2503 /** @fn truncate64(const char *file, off64_t length)
2506 @return Upon successful completion, both truncate64() and ftruncate64() shall return 0; otherwise, -1 shall be returned and errno set to indicate the error.
2508 For full documentation see: http://www.unix.org/version2/whatsnew/lfs20mar.html#3.0
2513 @externallyDefinedApi
2516 /** @fn brk(const void*)
2518 @return Function always returns 0.
2520 The brk function is used to change the amount of memory allocated in a
2521 process's data segment.It does this by moving the location of the "break".
2522 This functionality is not supported by the Symbian OS platform and hence
2523 is only build supported.
2535 @externallyDefinedApi
2538 /** @fn getdtablesize(void)
2541 Each process has a fixed size descriptor table,
2542 which is guaranteed to have at least 20 slots.
2544 the descriptor table are numbered with small integers starting at 0.
2545 The getdtablesize system call returns the size of this table.
2552 printf("maximum number of files that can be opened by a process is %d",getdtablesize());
2558 maximum number of files that can be opened by a process is 1024
2569 @externallyDefinedApi
2572 /** @fn getpagesize(void)
2573 The getpagesize function
2574 returns the number of bytes in a page.
2575 Page granularity is the granularity of many of the memory
2578 The page size is a system
2579 page size and may not be the same as the underlying
2586 int test_getpagesize()
2589 retVal = getpagesize();
2592 printf("getpagesize passed");
2594 retVal = %d " retVal);
2617 @externallyDefinedApi
2620 /** @fn initgroups(const char *, gid_t)
2622 @return These functions always return 0.
2626 The getgroups function is build supported but not available functionally.
2627 Symbian OS does not support multiple users and groups.
2636 @externallyDefinedApi
2639 /** @fn issetugid(void)
2640 @return The issetugid() function returns 1 if the process was made setuid or setgid as the result of the last or a previous call to execve(). Otherwise it returns 0
2642 The issetugid() function enables library functions (in lib-termlib, libc, or other libraries) to guarantee safe behavior when used in setuid or setgid programs. Some library functions might be passed insufficient informationand not know whether the current program was started setuidor setgid because a higher level calling code might have made changes to the uid, euid, gid, or egid. These low-levellibrary functions are therefore unable to determine if theyare being run with elevated or normal privileges.
2646 The issetugid() function is always successful. No return value is reserved to indicate an error.
2649 @externallyDefinedApi
2652 /** @fn mkstemp(char *template)
2654 @return The mkstemp function returns -1 if no suitable file could be created and an error code is placed in the global variable. errno.
2656 The mkstemp function takes the given file name template and overwrites a portion of it to create a file with that name and returns a file descriptor opened for reading and writing. This file name is guaranteed not to exist at the time of function invocation and is suitable for use by the application. The template may be any file name with some number of ‘X s’ appended to it, for example /tmp/temp.XXXXXX. The trailing ‘X s’ are replaced with a unique alphanumeric combination. The number of unique file names mkstemp can return depends on the number of ‘X s’ provided; six ‘X s’ will result in mkstemp selecting one of 56800235584 (62 ** 6) possible temporary file names.
2660 The mkstemp function may set errno to one of the following values:
2661 [ENOTDIR] The pathname portion of the template is not an existing directory.
2662 The mkstemp function may also set errno to any value specified by the stat function.
2663 The mkstemp function may also set errno to any value specified by the open function.
2668 #include <stdio.h> //printf, SEEK_SET
2673 char arr[] = "c:\\someXXXXXXXX";
2676 //create a temporary file using mkstemp()
2677 int fd = mkstemp(arr);
2682 write(fd, "hello", 5);
2683 //seek to the beginning of the file
2684 lseek(fd, 0, SEEK_SET); //beg of the file
2685 //read from the file
2692 printf("buf read: %s", buf);
2704 The template parameter of the mkstemp() function should not exceed 256 characters in length.
2707 @externallyDefinedApi
2710 /** @fn mkstemp64(char *template)
2712 @return The mkstemp64 function
2713 returns -1 if no suitable file could be created
2714 and an error code is placed in the global variable. errno.
2716 The mkstemp64() function generates a unique temporary file name from template. The last six characters of template must be XXXXXX and these are replaced with a string that makes the filename unique.
2718 The mkstemp64() function is a 64-bit version of mkstemp.
2723 @externallyDefinedApi
2726 /** @fn select(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *tvptr)
2732 @return The select system call
2733 returns the number of ready descriptors that are contained in
2734 the descriptor sets,
2735 or -1 if an error occurred.
2736 If the time limit expires, select returns 0.
2737 If select returns with an error,
2738 the descriptor sets will be unmodified.
2740 The select system call
2741 examines the I/O descriptor sets whose addresses are passed in readfds, writefds, and exceptfds to see if some of their descriptors
2742 are ready for reading, are ready for writing, or have an exceptional
2743 condition pending, respectively.
2744 The only exceptional condition detectable is out-of-band
2745 data received on a socket.
2746 The first maxfd descriptors are checked in each set;
2747 i.e., the descriptors from 0 through maxfd -1 in the descriptor sets are examined.
2748 On return, select replaces the given descriptor sets
2749 with subsets consisting of those descriptors that are ready
2750 for the requested operation.
2751 The select system call
2752 returns the total number of ready descriptors in all the sets.
2754 The descriptor sets are stored as bit fields in arrays of integers.
2755 The following macros are provided for manipulating such descriptor sets:
2758 FD_ZERO (&fdset;); initializes a descriptor set fdset to the null set.
2759 FD_SET (fd, &fdset;); includes a particular descriptor fd in fdset.
2760 FD_CLR (fd, &fdset;); removes fd from fdset.
2761 FD_ISSET (fd, &fdset;); is non-zero if fd is a member of fdset, zero otherwise.
2764 The behavior of these macros is undefined if
2765 a descriptor value is less than zero or greater than or equal to FD_SETSIZE, which is normally at least equal
2766 to the maximum number of descriptors supported by the system.
2768 If tvptr is not a null pointer, it specifies the maximum interval to wait for the
2769 selection to complete.
2770 System activity can lengthen the interval by
2771 an indeterminate amount.
2773 To effect a poll, the tvptr argument should not be a null pointer,
2774 but it should point to a zero-valued timeval structure.
2776 Any of readfds, writefds, and exceptfds may be given as null pointers if no descriptors are of interest.
2780 An error return from select indicates:
2781 [EBADF] One of the descriptor sets specified an invalid descriptor.
2782 [EFAULT] One of the arguments readfds, writefds, exceptfds, or tvptr points to an invalid address.
2783 [EINVAL] The specified time limit is invalid. One of its components is negative or too large.
2784 [EINVAL] The maxfd argument was invalid.
2788 select is not interrupted by signals, as signals are not supported by
2789 Symbian OS. If tvptr is set to null, select does not block forever, but waits for a maximum of 10 seconds
2790 and returns. select cannot be called a second time on the same socket descriptor
2791 before the first select operation on the same socket descriptor completes. (i.e) Only
2792 one select operation can be outstanding on a Socket. This is because of
2793 the limitation of the underlying Ioctl operation. Only one Ioctl operation may be outstanding for each socket.
2796 #include <sys/select.h>
2799 * A simple example of testing a single FD for readability
2800 * This example returns 1 when the fd is ready for reading.
2802 #include <sys/select.h>
2805 * A simple example of testing a single FD for readability
2806 * This example returns 1 when the fd is ready for reading.
2815 * FD_ZERO() clears out the fd_set called fds, so that
2816 * it doesn’t contain any file descriptors.
2820 * FD_SET() adds the file descriptor "fd" to the fd_set,
2821 * so that select() will return if fd is readable
2824 tv.tv_sec = tv.tv_usec = 0;
2826 * The first argument to select is the highest file
2827 * descriptor value plus 1.
2830 /* The second argument to select() is the address of
2831 * the fd_set that contains fd’s we’re waiting
2835 /* The third parameter is an fd_set that you want to
2836 * know if you can write on -- this example doesn’t
2837 * use it, so it passes 0, or NULL.
2839 /* The fourth parameter is sockets you’re waiting for
2840 * out-of-band data for.
2843 /* The last parameter to select() is a time-out of how
2844 * long select() should block.
2846 rc = select(fd+1, &fds, NULL, NULL, &tv);
2847 /* select() returns the number of fd’s that are ready
2848 * Once select() returns, the original fd_set has been
2849 * modified so it now reflects the state of why select()
2850 * woke up. i.e. If file descriptor 4 was originally in
2851 * the fd_set, and then it became readable, the fd_set
2852 * contains file descriptor 4 in it.
2856 return FD_ISSET(fd,&fds) ? 1 : 0;
2861 @see getdtablesize()
2871 The default size of FD_SETSIZE is currently set to 1024.
2872 In order to accommodate programs which might potentially
2873 use a larger number of open files with select, it is possible
2874 to increase this size by having the program define FD_SETSIZE before the inclusion of any header which includes
2876 \#include \< sys/types.h \>
2878 If maxfd is greater than the number of open files, select is not guaranteed to examine the unused file descriptors. For
2879 historical reasons, select will always examine the first 256 descriptors.
2881 The select system call appeared in BSD 4.2.
2885 <code> -susv2 </code> allows systems to modify the original tvptr in place.
2886 Thus, it is unwise to assume that the tvptr value will be unmodified
2887 by the select system call.
2893 @externallyDefinedApi
2896 /** @fn setgroups(int, const gid_t *)
2898 Refer to getgrent() for the documentation
2904 @externallyDefinedApi
2908 /** @fn alarm(unsigned int seconds)
2912 For full documentation see: http://www.opengroup.org/onlinepubs/009695399/functions/alarm.html
2914 The Symbian implementation of this API fully supports POSIX functionality.
2917 @externallyDefinedApi
2922 Environment variable.
2928 /** @def STDIN_FILENO
2930 standard input file descriptor
2933 @externallyDefinedApi
2936 /** @def STDOUT_FILENO
2938 standard output file descriptor
2941 @externallyDefinedApi
2944 /** @def STDERR_FILENO
2946 standard error file descriptor
2949 @externallyDefinedApi
2954 unlock locked section
2957 @externallyDefinedApi
2962 lock a section for exclusive use
2965 @externallyDefinedApi
2970 test and lock a section for exclusive use
2973 @externallyDefinedApi
2978 test a section for locks by other procs
2981 @externallyDefinedApi
2984 /** @def _SC_ARG_MAX
2986 POSIX-style system configuration variable accessors (for the sysconf function).
2989 @externallyDefinedApi
2992 /** @def _SC_CHILD_MAX
2994 POSIX-style system configuration variable accessors (for the sysconf function).
2997 @externallyDefinedApi
3000 /** @def _SC_CLK_TCK
3002 POSIX-style system configuration variable accessors (for the sysconf function).
3005 @externallyDefinedApi
3008 /** @def _SC_NGROUPS_MAX
3010 POSIX-style system configuration variable accessors (for the sysconf function).
3013 @externallyDefinedApi
3016 /** @def _SC_OPEN_MAX
3018 POSIX-style system configuration variable accessors (for the sysconf function).
3021 @externallyDefinedApi
3024 /** @def _SC_JOB_CONTROL
3026 POSIX-style system configuration variable accessors (for the sysconf function).
3029 @externallyDefinedApi
3032 /** @def _SC_SAVED_IDS
3034 POSIX-style system configuration variable accessors (for the sysconf function).
3037 @externallyDefinedApi
3040 /** @def _SC_VERSION
3042 POSIX-style system configuration variable accessors (for the sysconf function).
3045 @externallyDefinedApi
3048 /** @def _SC_BC_BASE_MAX
3050 POSIX-style system configuration variable accessors (for the sysconf function).
3053 @externallyDefinedApi
3056 /** @def _SC_BC_DIM_MAX
3058 POSIX-style system configuration variable accessors (for the sysconf function).
3061 @externallyDefinedApi
3064 /** @def _SC_BC_SCALE_MAX
3066 POSIX-style system configuration variable accessors (for the sysconf function).
3069 @externallyDefinedApi
3072 /** @def _SC_BC_STRING_MAX
3074 POSIX-style system configuration variable accessors (for the sysconf function).
3077 @externallyDefinedApi
3080 /** @def _SC_COLL_WEIGHTS_MAX
3082 POSIX-style system configuration variable accessors (for the sysconf function).
3085 @externallyDefinedApi
3088 /** @def _SC_EXPR_NEST_MAX
3090 POSIX-style system configuration variable accessors (for the sysconf function).
3093 @externallyDefinedApi
3096 /** @def _SC_LINE_MAX
3098 POSIX-style system configuration variable accessors (for the sysconf function).
3101 @externallyDefinedApi
3104 /** @def _SC_RE_DUP_MAX
3106 POSIX-style system configuration variable accessors (for the sysconf function).
3109 @externallyDefinedApi
3112 /** @def _SC_2_VERSION
3114 POSIX-style system configuration variable accessors (for the sysconf function).
3117 @externallyDefinedApi
3120 /** @def _SC_2_C_BIND
3122 POSIX-style system configuration variable accessors (for the sysconf function).
3125 @externallyDefinedApi
3128 /** @def _SC_2_C_DEV
3130 POSIX-style system configuration variable accessors (for the sysconf function).
3133 @externallyDefinedApi
3136 /** @def _SC_2_CHAR_TERM
3138 POSIX-style system configuration variable accessors (for the sysconf function).
3141 @externallyDefinedApi
3144 /** @def _SC_2_FORT_DEV
3146 POSIX-style system configuration variable accessors (for the sysconf function).
3149 @externallyDefinedApi
3152 /** @def _SC_2_FORT_RUN
3154 POSIX-style system configuration variable accessors (for the sysconf function).
3157 @externallyDefinedApi
3160 /** @def _SC_2_LOCALEDEF
3162 POSIX-style system configuration variable accessors (for the sysconf function).
3165 @externallyDefinedApi
3168 /** @def _SC_2_SW_DEV
3170 POSIX-style system configuration variable accessors (for the sysconf function).
3173 @externallyDefinedApi
3178 POSIX-style system configuration variable accessors (for the sysconf function).
3181 @externallyDefinedApi
3184 /** @def _SC_STREAM_MAX
3186 POSIX-style system configuration variable accessors (for the sysconf function).
3189 @externallyDefinedApi
3192 /** @def _SC_TZNAME_MAX
3194 POSIX-style system configuration variable accessors (for the sysconf function).
3197 @externallyDefinedApi
3200 /** @def _SC_ASYNCHRONOUS_IO
3202 POSIX-style system configuration variable accessors (for the sysconf function).
3205 @externallyDefinedApi
3208 /** @def _SC_MAPPED_FILES
3210 POSIX-style system configuration variable accessors (for the sysconf function).
3213 @externallyDefinedApi
3216 /** @def _SC_MEMLOCK
3218 POSIX-style system configuration variable accessors (for the sysconf function).
3221 @externallyDefinedApi
3224 /** @def _SC_MEMLOCK_RANGE
3226 POSIX-style system configuration variable accessors (for the sysconf function).
3229 @externallyDefinedApi
3232 /** @def _SC_MEMORY_PROTECTION
3234 POSIX-style system configuration variable accessors (for the sysconf function).
3237 @externallyDefinedApi
3240 /** @def _SC_MESSAGE_PASSING
3242 POSIX-style system configuration variable accessors (for the sysconf function).
3245 @externallyDefinedApi
3248 /** @def _SC_PRIORITIZED_IO
3250 POSIX-style system configuration variable accessors (for the sysconf function).
3253 @externallyDefinedApi
3256 /** @def _SC_PRIORITY_SCHEDULING
3258 POSIX-style system configuration variable accessors (for the sysconf function).
3261 @externallyDefinedApi
3264 /** @def _SC_REALTIME_SIGNALS
3266 POSIX-style system configuration variable accessors (for the sysconf function).
3269 @externallyDefinedApi
3272 /** @def _SC_SEMAPHORES
3274 POSIX-style system configuration variable accessors (for the sysconf function).
3277 @externallyDefinedApi
3282 POSIX-style system configuration variable accessors (for the sysconf function).
3285 @externallyDefinedApi
3288 /** @def _SC_SHARED_MEMORY_OBJECTS
3290 POSIX-style system configuration variable accessors (for the sysconf function).
3293 @externallyDefinedApi
3296 /** @def _SC_SYNCHRONIZED_IO
3298 POSIX-style system configuration variable accessors (for the sysconf function).
3301 @externallyDefinedApi
3306 POSIX-style system configuration variable accessors (for the sysconf function).
3309 @externallyDefinedApi
3312 /** @def _SC_AIO_LISTIO_MAX
3314 POSIX-style system configuration variable accessors (for the sysconf function).
3317 @externallyDefinedApi
3320 /** @def _SC_AIO_MAX
3322 POSIX-style system configuration variable accessors (for the sysconf function).
3325 @externallyDefinedApi
3328 /** @def _SC_AIO_PRIO_DELTA_MAX
3330 POSIX-style system configuration variable accessors (for the sysconf function).
3333 @externallyDefinedApi
3336 /** @def _SC_DELAYTIMER_MAX
3338 POSIX-style system configuration variable accessors (for the sysconf function).
3341 @externallyDefinedApi
3344 /** @def _SC_MQ_OPEN_MAX
3346 POSIX-style system configuration variable accessors (for the sysconf function).
3349 @externallyDefinedApi
3352 /** @def _SC_PAGESIZE
3354 POSIX-style system configuration variable accessors (for the sysconf function).
3357 @externallyDefinedApi
3360 /** @def _SC_RTSIG_MAX
3362 POSIX-style system configuration variable accessors (for the sysconf function).
3365 @externallyDefinedApi
3368 /** @def _SC_SEM_NSEMS_MAX
3370 POSIX-style system configuration variable accessors (for the sysconf function).
3373 @externallyDefinedApi
3376 /** @def _SC_SEM_VALUE_MAX
3378 POSIX-style system configuration variable accessors (for the sysconf function).
3381 @externallyDefinedApi
3384 /** @def _SC_SIGQUEUE_MAX
3386 POSIX-style system configuration variable accessors (for the sysconf function).
3389 @externallyDefinedApi
3392 /** @def _SC_TIMER_MAX
3394 POSIX-style system configuration variable accessors (for the sysconf function).
3397 @externallyDefinedApi
3402 POSIX-style system configuration variable accessors (for the sysconf function).
3405 @externallyDefinedApi
3408 /** @def _SC_2_PBS_ACCOUNTING
3410 POSIX-style system configuration variable accessors (for the sysconf function).
3413 @externallyDefinedApi
3416 /** @def _SC_2_PBS_CHECKPOINT
3418 POSIX-style system configuration variable accessors (for the sysconf function).
3421 @externallyDefinedApi
3424 /** @def _SC_2_PBS_LOCATE
3426 POSIX-style system configuration variable accessors (for the sysconf function).
3429 @externallyDefinedApi
3432 /** @def _SC_2_PBS_MESSAGE
3434 POSIX-style system configuration variable accessors (for the sysconf function).
3437 @externallyDefinedApi
3440 /** @def _SC_2_PBS_TRACK
3442 POSIX-style system configuration variable accessors (for the sysconf function).
3445 @externallyDefinedApi
3448 /** @def _SC_ADVISORY_INFO
3450 POSIX-style system configuration variable accessors (for the sysconf function).
3453 @externallyDefinedApi
3456 /** @def _SC_BARRIERS
3458 POSIX-style system configuration variable accessors (for the sysconf function).
3461 @externallyDefinedApi
3464 /** @def _SC_CLOCK_SELECTION
3466 POSIX-style system configuration variable accessors (for the sysconf function).
3469 @externallyDefinedApi
3472 /** @def _SC_CPUTIME
3474 POSIX-style system configuration variable accessors (for the sysconf function).
3477 @externallyDefinedApi
3480 /** @def _SC_FILE_LOCKING
3482 POSIX-style system configuration variable accessors (for the sysconf function).
3485 @externallyDefinedApi
3488 /** @def _SC_GETGR_R_SIZE_MAX
3490 POSIX-style system configuration variable accessors (for the sysconf function).
3493 @externallyDefinedApi
3496 /** @def _SC_GETPW_R_SIZE_MAX
3498 POSIX-style system configuration variable accessors (for the sysconf function).
3501 @externallyDefinedApi
3504 /** @def _SC_HOST_NAME_MAX
3506 POSIX-style system configuration variable accessors (for the sysconf function).
3509 @externallyDefinedApi
3512 /** @def _SC_LOGIN_NAME_MAX
3514 POSIX-style system configuration variable accessors (for the sysconf function).
3517 @externallyDefinedApi
3520 /** @def _SC_MONOTONIC_CLOCK
3522 POSIX-style system configuration variable accessors (for the sysconf function).
3525 @externallyDefinedApi
3528 /** @def _SC_MQ_PRIO_MAX
3530 POSIX-style system configuration variable accessors (for the sysconf function).
3533 @externallyDefinedApi
3536 /** @def _SC_READER_WRITER_LOCKS
3538 POSIX-style system configuration variable accessors (for the sysconf function).
3541 @externallyDefinedApi
3546 POSIX-style system configuration variable accessors (for the sysconf function).
3549 @externallyDefinedApi
3554 POSIX-style system configuration variable accessors (for the sysconf function).
3557 @externallyDefinedApi
3562 POSIX-style system configuration variable accessors (for the sysconf function).
3565 @externallyDefinedApi
3568 /** @def _SC_SPIN_LOCKS
3570 POSIX-style system configuration variable accessors (for the sysconf function).
3573 @externallyDefinedApi
3576 /** @def _SC_SPORADIC_SERVER
3578 POSIX-style system configuration variable accessors (for the sysconf function).
3581 @externallyDefinedApi
3584 /** @def _SC_THREAD_ATTR_STACKADDR
3586 POSIX-style system configuration variable accessors (for the sysconf function).
3589 @externallyDefinedApi
3592 /** @def _SC_THREAD_ATTR_STACKSIZE
3594 POSIX-style system configuration variable accessors (for the sysconf function).
3597 @externallyDefinedApi
3600 /** @def _SC_THREAD_CPUTIME
3602 POSIX-style system configuration variable accessors (for the sysconf function).
3605 @externallyDefinedApi
3608 /** @def _SC_THREAD_DESTRUCTOR_ITERATIONS
3610 POSIX-style system configuration variable accessors (for the sysconf function).
3613 @externallyDefinedApi
3616 /** @def _SC_THREAD_KEYS_MAX
3618 POSIX-style system configuration variable accessors (for the sysconf function).
3621 @externallyDefinedApi
3624 /** @def _SC_THREAD_PRIO_INHERIT
3626 POSIX-style system configuration variable accessors (for the sysconf function).
3629 @externallyDefinedApi
3632 /** @def _SC_THREAD_PRIO_PROTECT
3634 POSIX-style system configuration variable accessors (for the sysconf function).
3637 @externallyDefinedApi
3640 /** @def _SC_THREAD_PRIORITY_SCHEDULING
3642 POSIX-style system configuration variable accessors (for the sysconf function).
3645 @externallyDefinedApi
3648 /** @def _SC_THREAD_PROCESS_SHARED
3650 POSIX-style system configuration variable accessors (for the sysconf function).
3653 @externallyDefinedApi
3656 /** @def _SC_THREAD_SAFE_FUNCTIONS
3658 POSIX-style system configuration variable accessors (for the sysconf function).
3661 @externallyDefinedApi
3664 /** @def _SC_THREAD_SPORADIC_SERVER
3666 POSIX-style system configuration variable accessors (for the sysconf function).
3669 @externallyDefinedApi
3672 /** @def _SC_THREAD_STACK_MIN
3674 POSIX-style system configuration variable accessors (for the sysconf function).
3677 @externallyDefinedApi
3680 /** @def _SC_THREAD_THREADS_MAX
3682 POSIX-style system configuration variable accessors (for the sysconf function).
3685 @externallyDefinedApi
3688 /** @def _SC_TIMEOUTS
3690 POSIX-style system configuration variable accessors (for the sysconf function).
3693 @externallyDefinedApi
3696 /** @def _SC_THREADS
3698 POSIX-style system configuration variable accessors (for the sysconf function).
3701 @externallyDefinedApi
3706 POSIX-style system configuration variable accessors (for the sysconf function).
3709 @externallyDefinedApi
3712 /** @def _SC_TRACE_EVENT_FILTER
3714 POSIX-style system configuration variable accessors (for the sysconf function).
3717 @externallyDefinedApi
3720 /** @def _SC_TRACE_INHERIT
3722 POSIX-style system configuration variable accessors (for the sysconf function).
3725 @externallyDefinedApi
3728 /** @def _SC_TRACE_LOG
3730 POSIX-style system configuration variable accessors (for the sysconf function).
3733 @externallyDefinedApi
3736 /** @def _SC_TTY_NAME_MAX
3738 POSIX-style system configuration variable accessors (for the sysconf function).
3741 @externallyDefinedApi
3744 /** @def _SC_TYPED_MEMORY_OBJECTS
3746 POSIX-style system configuration variable accessors (for the sysconf function).
3749 @externallyDefinedApi
3752 /** @def _SC_V6_ILP32_OFF32
3754 POSIX-style system configuration variable accessors (for the sysconf function).
3757 @externallyDefinedApi
3760 /** @def _SC_V6_ILP32_OFFBIG
3762 POSIX-style system configuration variable accessors (for the sysconf function).
3765 @externallyDefinedApi
3768 /** @def _SC_V6_LP64_OFF64
3770 POSIX-style system configuration variable accessors (for the sysconf function).
3773 @externallyDefinedApi
3776 /** @def _SC_V6_LPBIG_OFFBIG
3778 POSIX-style system configuration variable accessors (for the sysconf function).
3781 @externallyDefinedApi
3786 POSIX-style system configuration variable accessors (for the sysconf function).
3789 @externallyDefinedApi
3792 /** @def _SC_RAW_SOCKETS
3794 POSIX-style system configuration variable accessors (for the sysconf function).
3797 @externallyDefinedApi
3800 /** @def _SC_SYMLOOP_MAX
3802 POSIX-style system configuration variable accessors (for the sysconf function).
3805 @externallyDefinedApi
3808 /** @def _SC_ATEXIT_MAX
3810 POSIX-style system configuration variable accessors (for the sysconf function).
3813 @externallyDefinedApi
3816 /** @def _SC_IOV_MAX
3818 POSIX-style system configuration variable accessors (for the sysconf function).
3821 @externallyDefinedApi
3824 /** @def _SC_PAGE_SIZE
3826 POSIX-style system configuration variable accessors (for the sysconf function).
3829 @externallyDefinedApi
3832 /** @def _SC_XOPEN_CRYPT
3834 POSIX-style system configuration variable accessors (for the sysconf function).
3837 @externallyDefinedApi
3840 /** @def _SC_XOPEN_ENH_I18N
3842 POSIX-style system configuration variable accessors (for the sysconf function).
3845 @externallyDefinedApi
3848 /** @def _SC_XOPEN_LEGACY
3850 POSIX-style system configuration variable accessors (for the sysconf function).
3853 @externallyDefinedApi
3856 /** @def _SC_XOPEN_REALTIME
3858 POSIX-style system configuration variable accessors (for the sysconf function).
3861 @externallyDefinedApi
3864 /** @def _SC_XOPEN_REALTIME_THREADS
3866 POSIX-style system configuration variable accessors (for the sysconf function).
3869 @externallyDefinedApi
3872 /** @def _SC_XOPEN_SHM
3874 POSIX-style system configuration variable accessors (for the sysconf function).
3877 @externallyDefinedApi
3880 /** @def _SC_XOPEN_STREAMS
3882 POSIX-style system configuration variable accessors (for the sysconf function).
3885 @externallyDefinedApi
3888 /** @def _SC_XOPEN_UNIX
3890 POSIX-style system configuration variable accessors (for the sysconf function).
3893 @externallyDefinedApi
3896 /** @def _SC_XOPEN_VERSION
3898 POSIX-style system configuration variable accessors (for the sysconf function).
3901 @externallyDefinedApi
3904 /** @def _SC_XOPEN_XCU_VERSION
3906 POSIX-style system configuration variable accessors (for the sysconf function).
3909 @externallyDefinedApi
3914 Keys for the confstr(3) function.
3917 @externallyDefinedApi
3920 /** @def _CS_POSIX_V6_ILP32_OFF32_CFLAGS
3922 Keys for the confstr(3) function.
3925 @externallyDefinedApi
3928 /** @def _CS_POSIX_V6_ILP32_OFF32_LDFLAGS
3930 Keys for the confstr(3) function.
3933 @externallyDefinedApi
3936 /** @def _CS_POSIX_V6_ILP32_OFF32_LIBS
3938 Keys for the confstr(3) function.
3941 @externallyDefinedApi
3944 /** @def _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS
3946 Keys for the confstr(3) function.
3949 @externallyDefinedApi
3952 /** @def _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS
3954 Keys for the confstr(3) function.
3957 @externallyDefinedApi
3960 /** @def _CS_POSIX_V6_LP64_OFF64_CFLAGS
3962 Keys for the confstr(3) function.
3965 @externallyDefinedApi
3968 /** @def _CS_POSIX_V6_LP64_OFF64_CFLAGS
3970 Keys for the confstr(3) function.
3973 @externallyDefinedApi
3976 /** @def _CS_POSIX_V6_LP64_OFF64_LDFLAGS
3978 Keys for the confstr(3) function.
3981 @externallyDefinedApi
3984 /** @def _CS_POSIX_V6_LP64_OFF64_LIBS
3986 Keys for the confstr(3) function.
3989 @externallyDefinedApi
3992 /** @def _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS
3994 Keys for the confstr(3) function.
3997 @externallyDefinedApi
4002 character checked for validity
4005 @externallyDefinedApi
4010 if error message should be printed
4013 @externallyDefinedApi
4018 index into parent argv vector
4021 @externallyDefinedApi
4026 argument associated with option
4029 @externallyDefinedApi
4037 @externallyDefinedApi
4040 /** @typedef typedef __off_t off_t
4042 Used for file sizes.
4045 @externallyDefinedApi
4048 /** @typedef typedef __gid_t gid_t
4053 @externallyDefinedApi
4056 /** @typedef typedef __pid_t pid_t
4058 Used for process IDs and process group IDs.
4061 @externallyDefinedApi
4064 /** @typedef typedef __size_t size_t
4066 Used for sizes of objects.
4069 @externallyDefinedApi
4072 /** @typedef typedef __uid_t uid_t
4077 @externallyDefinedApi
4080 /** @typedef typedef __useconds_t useconds_t
4082 Used for time in microseconds.
4085 @externallyDefinedApi