---
title: Function Status
framework: GSS
role: collectionGroup
role_heading: API Collection
path: gss/function-status
---

# Function Status

Evaluate return values that most GSS-API functions use to indicate the outcome of an operation.

## Overview

Overview The functions of the GSS-API return two status codes. The major status code, delivered as the function’s return value, provides a mechanism-independent status output. A value of GSS_S_COMPLETE typically indicates success, but the code is actually composed of several fields that enable communicating a more nuanced result.  Always check the major status code to determine if an operation succeeds. The minor status code provides additional information, often mechanism-specific, when an operation fails. This result returns using the OM_uint32 pointer given as the function’s first argument. Examine this value to further debug a problem. For example, many functions allocate memory as a side effect of their main task. If memory allocation fails, the entire operation fails. But while the major status indicates a generic problem, a minor status of ENOMEM indicates that failed memory allocation is the exact culprit. Three bitfields bundled together make up major status codes in a single OM_uint32 value. These fields are: When a function successfully runs to completion, it returns zero for all of these fields. As a convenience, you can compare the result directly with the status code GSS_S_COMPLETE to test for this condition.

For any other result, use one of the available extraction macros (such as GSS_CALLING_ERROR) to obtain a value that you compare against one of the known error codes. For example, you can test for a failure to read one of the function inputs as follows: OM_uint32 major = <# Some GSS call #> if (GSS_CALLING_ERROR(major) == GSS_S_CALL_INACCESSIBLE_READ) {     // Handle the error } Use the gss_display_status(_:_:_:_:_:_:) function to retrieve a human readable string corresponding to a given status result.

## Topics

### Status and Error Creation

- [OM_uint32](gss/om_uint32.md)
- [OM_uint64](gss/om_uint64.md)
- [gss_uint32](gss/gss_uint32.md)
- [gss_status_id_t](gss/gss_status_id_t.md)
- [GSS_C_MECH_CODE](gss/gss_c_mech_code.md)
- [GSS_C_GSS_CODE](gss/gss_c_gss_code.md)
- [GSS_S_COMPLETE](gss/gss_s_complete.md)
- [gss_display_status(_:_:_:_:_:_:)](gss/gss_display_status(_:_:_:_:_:_:).md)
- [GSSCreateError(_:_:_:)](gss/gsscreateerror(_:_:_:).md)

### Calling Errors

- [GSS_S_CALL_BAD_STRUCTURE](gss/gss_s_call_bad_structure.md)
- [GSS_S_CALL_INACCESSIBLE_READ](gss/gss_s_call_inaccessible_read.md)
- [GSS_S_CALL_INACCESSIBLE_WRITE](gss/gss_s_call_inaccessible_write.md)

### Routine Errors

- [GSS_S_BAD_MECH](gss/gss_s_bad_mech.md)
- [GSS_S_BAD_NAME](gss/gss_s_bad_name.md)
- [GSS_S_BAD_NAMETYPE](gss/gss_s_bad_nametype.md)
- [GSS_S_BAD_MIC](gss/gss_s_bad_mic.md)
- [GSS_S_BAD_SIG](gss/gss_s_bad_sig.md)
- [GSS_S_BAD_STATUS](gss/gss_s_bad_status.md)
- [GSS_S_BAD_BINDINGS](gss/gss_s_bad_bindings.md)
- [GSS_S_NO_CRED](gss/gss_s_no_cred.md)
- [GSS_S_NO_CONTEXT](gss/gss_s_no_context.md)
- [GSS_S_DEFECTIVE_TOKEN](gss/gss_s_defective_token.md)
- [GSS_S_DEFECTIVE_CREDENTIAL](gss/gss_s_defective_credential.md)
- [GSS_S_CREDENTIALS_EXPIRED](gss/gss_s_credentials_expired.md)
- [GSS_S_CONTEXT_EXPIRED](gss/gss_s_context_expired.md)
- [GSS_S_FAILURE](gss/gss_s_failure.md)
- [GSS_S_BAD_QOP](gss/gss_s_bad_qop.md)
- [GSS_S_UNAUTHORIZED](gss/gss_s_unauthorized.md)
- [GSS_S_UNAVAILABLE](gss/gss_s_unavailable.md)
- [GSS_S_DUPLICATE_ELEMENT](gss/gss_s_duplicate_element.md)
- [GSS_S_NAME_NOT_MN](gss/gss_s_name_not_mn.md)
- [GSS_S_BAD_MECH_ATTR](gss/gss_s_bad_mech_attr.md)
- [GSS_S_CRED_UNAVAIL](gss/gss_s_cred_unavail.md)

### Masks and Offsets

- [GSS_C_CALLING_ERROR_MASK](gss/gss_c_calling_error_mask.md)
- [GSS_C_CALLING_ERROR_OFFSET](gss/gss_c_calling_error_offset.md)
- [GSS_C_ROUTINE_ERROR_MASK](gss/gss_c_routine_error_mask.md)
- [GSS_C_ROUTINE_ERROR_OFFSET](gss/gss_c_routine_error_offset.md)
- [GSS_C_SUPPLEMENTARY_MASK](gss/gss_c_supplementary_mask.md)
- [GSS_C_SUPPLEMENTARY_OFFSET](gss/gss_c_supplementary_offset.md)

## See Also

### Memory and Context

- [Allocating and Releasing Objects](gss/allocating-and-releasing-objects.md)
- [Buffer Management](gss/buffer-management.md)
- [Context Services](gss/context-services.md)
