Language Enhancement in ColdFusion 8 - CFUnited 2007
Unit 1
1.
2.
3. Darshan,S.J.B.I.T The POSIX Feature Test Macros 3. _POSIX_CHOWN_RESTRICTED: If the defined value is -1 ,users may change Ownership of files owned by them . If the value is not -1 ,then only the users with special privileges may change the Ownership of nay files on a system. If this constant is undefined in <unistd.h> header,user must use the pathconf() Or fpathconf() function. 4._POSIX_NO_TRUNC : If the defined values is -1 ,any long pathname passed to an API is truncated to _POSIX_NAME_MAX bytes,otherwise any error is generated. If this constant is undefined in <unistd.h> header,user must use the pathconf() Or fpathconf() function. 5._POSIX_VDISABLE: If the defined value is -1 ,then there is no disabling character for special charactersfor all terminal devices files. If this constant is undefined in <unistd.h> header,user must use the pathconf() Or fpathconf() function.
4. Darshan,S.J.B.I.T Show test macros #define _POSIX_SOURCE #define _POSIX_C_SOURCE 199309L #include <iostream.h> #include <unistd.h> int main() { #ifdef _POSIX_JOB_CONTROL cout<<“System supports job control”; #else cout<<“System does not support job control”; #endif . . . . }
5. Darshan,S.J.B.I.T Limits checking at compile time and at run time POSIX.1 & POSIX.1b define a set of system configuration limits in the form of Constant in <limits.h> header. Compile time limit Value Meaning _POSIX_NGROUP_MAX 0 Maximum number of supplement groups to which a process may belong . _POSIX_TZNAME_MAX 3 Maximum number of characters in a time zone name _ POSIX_CHILD_MAX 6 Maximum number of child processes that may created at any one time by a process _POSIX_LINK_MAX 8 Maximum number of links a file may have _ POSIX_STREAM_MAX 8 Maximum number of I/O streams that may be simultaneously by a process _ POSIX_NAME_MAX 14 Maximum number of characters allowed in a filename _POSIX_OPEN_MAX 16 Maximum number of file that may be opened simultaneously by a process _ POSIX_PATH_MAX 255 Maximum number of characters allowed in a pathname _POSIX_MAX_INPUT 255 Maximum size in bytes of terminal’s input queue _POSIX_MAX_CANON 255 Maximum size in bytes of terminal’s canonical input queue _POSIX_ARG_MAX 4096 Maximum length of argument to the exec functions including environment data. _ POSIX_SSIZE_MAX 32767 Maximum value that can be stored in an object of type ssize_t .
6. Darshan,S.J.B.I.T POSIX.1B CONSTANTS COMPILE TIME LIMIT VALUE MEANING _POSIX_AIO_MAX 1 The number of simultaneously asynchronous I/O operations. _POSIX_AIO_LISTIO_MAX 2 The number of I/O operations that can be specified in a list I/O call . _POSIX_MQ_OPEN_MAX 2 The number of message queues that can be open for a single process. _POSIX_MQ_PRIO_MAX 2 The maximum number of message priorities that can be assigned to messages _POSIX_RTSIG_MAX 8 The maximum number of realtime signal . _POSIX_TIMER_MAX 32 Maximum number of timers that can be used simultaneously number of timers. _POSIX_SIGQUEUE_MAX 32 Maximum number of realtime signals that a process may queue at any one time _POSIX_DELAYTIMER_MAX 32 Maximum number of overruns allowed per timer. _POSIX_SEM_NSEMS_MAX 256 Maximum number of semaphore s that may be used simultaneously per process _POSIX_SEM_VALUE_MAX 32767 The maximum value a semaphore may have
7. Darshan,S.J.B.I.T sysconf, pathconf & fpathconf To find out the actual implemented configuration limit system wide we can use sysconf,pathconf & fpathconf The prototype of these functions are: #include<unistd.h> long sysconf ( const int limit_name); long pathconf ( const char* pathname, int flimit_name); long fpathconf ( const int fdesc,int flimit_name); The sysconf is used to query general system configuration limits that are implemented on a given system. The pathconf & fpathconf are used to query file-related configuration limits.
8. Darshan,S.J.B.I.T The possible limited value by the sysconf function Limit value sysconf return data _ SG_ARG_MAX Maximum length of argument to the exec functions including environment data. _SC_AIO_LISTIO_MAX The number of I/O operations that can be specified in a list I/O call . _SC_AIO_MAX The number of simultaneously asynchronous I/O operations _SC_CHILD_MAX Maximum number of child processes that may created at any one time by a process _SC_CLK_TCK The number of clock ticks per second. _ SC_DELAYTIMER_MAX Maximum number of overruns allowed per timer _SC_JOB_CONTROL The POSIX_JOB_CONTROL value _SC_MQ_OPEN_MAX Maximum number of message queues per process _SC_MQ_PRIO_MAX Maximum priority value assignable to a message _SC_NGRUOP_MAX Maximum number of supplemental groups per process
9. Darshan,S.J.B.I.T The possible limited value by the sysconf function LIMIT VALUE sysconf return Data _SC_OPEN_MAX Maximum number of opened files per process _SC_RTSIG_MAX Maximum number of real time signals _SC_SAVED_IDS The _POSIX_SAVED_IDS value _ SC_SEM_NSEMS_MAX Maximum number of semaphores per process _SC_SIGQUEUE_MAX Maximum number of realtime signals that a process may queue at any one-time _SC_TIMERS The _POSIX_TIMERS Value _SC_VERSION The _POSIX_VERSION value.
10. Darshan,S.J.B.I.T The possible limited value by the pathconf & fpathconf function Limit value pathconf/fathconf return Data _ PC_CHOWN_RESTRICTED The _POSIX_CHOWN_RESTRICTED value. _PC_LINK_MAX Maximum number of links a file may have _PC_MAX_CANON Maximum size in bytes of terminal canonical input queue _PC_MAX_INPUT Maximum size in bytes of terminal input queue _PC_NO_TRUNC The _POSIX_NO_TRUNC value _PC_NAME_MAX Maximum length in bytes of a file name. _PC_PATH_MAX Maximum length in bytes of a pathname _PC_PIPE_BUF Maximum size of a block of data that may be automatically read from or written to a pipe file _PC_VDISABLE The _POSIX_VDISABLE value
11.
12. Darshan,S.J.B.I.T The X/Open Standards X/Open organization was formed by a group of European companies to propose a common OS interface for their computing systems. XPG3 – 1989 XPG4 – 1994 COSE (Common Open software Environment) formed in 1993 by HP, IBM, Novell, OSF and Sun Microsystems SPEC 1179 Incorporated in XPG4 as part of X/Open Common Application Environment
13. Darshan,S.J.B.I.T Unix & POSIX API”S UNIX systems provides a set of application programming interface(API”S) functions commonly known as system calls which may be called user’s programs to perform System specific functions. These fuctions allows user’s applications to directly to manipulate system objects such as files and processes that cannot be done by using standard C library functions. Functions of API”S 1.Determine system configuration and user Infromation 2.File Manipulation 3.Process creation & control. 4.Interprocess communication 5.Network Communication
14. Darshan,S.J.B.I.T What happens when an API’s is called When an API’s is invoked by a process,then execution context is switched by the kernel from a usermode to a kernel mode User mode : is the normal execution context of any user process. It allows the process to access its process-specific data only. Kernel mode : Is a protective execution environment that allows a user to access kernels data in a restricted manner. In general ,calling an API is more time consuming than calling a user function due to Context switching
15. Darshan,S.J.B.I.T API COMMON CHARACTERISTICS POSIX & UNIX API’s after performing the system functions returns an integer value which indicates the termination status of the execution. If an API returns -1 value,it means the API’s execution has failed,& global variable Declared in the <errno.h> header is set with an error code. A user process may call the perror function to print a message of the failure To the standard output. or It may call the strerror function returns a message string & the user process may Print that message in its preferred way.
16. Darshan,S.J.B.I.T ERROR STATUS CODE ERROR STATUS CODE Meaning EACCESS A process doesn't have access permission to perform an operation via an API EAGAIN An API was aborted because some system resource it requested was temporarily unavailable. So the API should be called again later EBADF An API was called with an Invalid file descriptor ECHILD A process doesnot have any child process which it can wait on EFAULT An API was passed an invalid address in one of its argument EINTR An API execution was aborted due to signal Interruption EIO I/O error occurred in a API execution ENOENT An invalid filename was specified to an API ENOEXEC An AP Couldn't execute a program via of the exec API EPERM An API was aborted because the calling process doesn't have the superuser privilege EPIPE An API attempted to write data to a pipe which has no reader ENOMEM An API was aborted because it could allocate Dynamic memory