File: utsname.hxx

package info (click to toggle)
omniorb 1%3A3.0.4.1-8
  • links: PTS
  • area: main
  • in suites: woody
  • size: 13,024 kB
  • ctags: 19,172
  • sloc: cpp: 80,906; python: 17,895; ansic: 17,630; yacc: 3,441; lex: 1,306; sh: 1,191; xml: 871; perl: 383; makefile: 108; tcl: 18
file content (53 lines) | stat: -rw-r--r-- 1,045 bytes parent folder | download | duplicates (14)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef utsname_hxx
#define utsname_hxx

#if defined(__VMS) && __VMS_VER < 70000000

//  provide uname functionality (note: only nodename is returned) for OpenVMS
//  systems older than 7.0

#include <errno.h>
#include <descrip.h>
#include <lib$routines.h>
#include <syidef.h>

struct utsname {
    char nodename[1024+1];   /*  DECnet node name                    */
};

static int uname (utsname* name) {

    const int nodeNameCode(SYI$_NODENAME);

    dsc$descriptor_s dx;
    dx.dsc$w_length = 1024;
    dx.dsc$b_dtype = DSC$K_DTYPE_T;
    dx.dsc$b_class = DSC$K_CLASS_S;
    dx.dsc$a_pointer = name->nodename;

    unsigned short length(0);

    vaxc$errno = lib$getsyi(
	&nodeNameCode,		// item-code
	0,			// resultant-value (ignored)
	&dx,			// resultant-string
	&length,		// resultant-length
	0,			// cluster-system-id
	0			// node-name
    );
    name->nodename[length]=0;

    int result = (vaxc$errno & 1) ? 0 : -1;
    if (result == -1) {
	errno = EVMSERR;
    }
    return result;
}

#else

#include <sys/utsname.h>

#endif

#endif