unixdev.net


Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (OSF1-V5.1-alpha)
Page:
Section:
Apropos / Subsearch:
optional field



uswitch(2)							   uswitch(2)



NAME

  uswitch - Get	or set compatibility environment specific behavior for a cal-
  ling process through the uswitch value.

SYNOPSIS

  #include <&lt;sys/uswitch.h>&gt;


  long uswitch(
	  long cmd,
	  long mask );

PARAMETERS

  cmd Specifies	the requested actions. The valid cmd values are:

      USC_GET
	  Returns the current uswitch value for	the calling process.  If mask
	  is non-zero, it returns the status of	specific uswitch bit-mask(s).

      USC_SET
	  Changes the current uswitch value for	the calling process as speci-
	  fied by the mask bit-mask(s).

  mask
      The following bit-masks are valid	when specified with either of the
      values for the cmd parameter:

      USW_NULLP
	  Specifies System V NULL pointer behavior.

      USW_CORE
	  Specifies process requests enhanced core file	naming.

DESCRIPTION

  The uswitch system call is used to get or change the compatibility environ-
  ment specific	behavior in Tru64 UNIX.	 Any changes affect the	calling	pro-
  cess and its children.

  When the USW_NULLP bit of uswitch is set to 1, the System V method of
  treating NULL	pointers is applied. In	this method, references	to a NULL
  pointer always returns zero (0).  When this bit-mask is reset	to zero	(0),
  subsequent references	to a NULL pointer generate a segmentation violation
  signal (SIGSEGV).

  When the USW_CORE bit	of uswitch is set to 1,	the process requests enhanced
  core file naming.  The bit-mask, when	set, can be inherited when the pro-
  cess forks.  The bit-mask is cleared when an exec system call	is executed.
  See core(4) for more information about core files.

  Any write(2) references to NULL pointers generate a segmentation violation
  signal (SIGSEGV) regardless of the uswitch value.





NOTES

  Usage	of this	system call may	make the application non-portable.

RETURN VALUES

  Upon successful completion, either the current or new	uswitch	value for
  mask is returned.  Otherwise,	a value	of -1 is returned and errno is set to
  indicate the error.

ERRORS

  If the uswitch system	call fails, the	uswitch	value remains unchanged	and
  errno	is set to the following:

  [EINVAL]
      The mask is greater than USW_MAX or less than USW_MIN.

EXAMPLES

   1.  The following code sample sets the bit mask for System V	NULL pointer
       behavior:


	    long uswitch_val;

	    ...
	    uswitch_val	= uswitch(USC_GET,0);	       /* Gets current value*/
	    uswitch(USC_SET, uswitch_val | USW_NULLP); /* Sets USW_NULLP bit */

   2.  The following code sample sets the bit mask for enhanced	core file
       names:


	    long uswitch_val;

	    ...
	    uswitch_val	= uswitch(USC_GET,0);	      /* Gets current value*/
	    uswitch(USC_SET, uswitch_val | USW_CORE); /* Sets USW_CORE bit */