Skip to contentSkip to conversation

utssys?

parisc-linux Matthew Wilcox 4 participants 6 messages Aug 7, 1999 – Aug 10, 1999

lore
Share & tools
lore
#0 lore raw

Can anyone tell me what the utssys() system call does? There's no manual page for it. From tusc, I can see:

utssys("HP-UX", 0, 0) ............................................ = 0

so all I need do to get it to work on Linux is return 0, but I'd like to understand a little more.

I also can't find a manual page for sigsetreturn() which I probably need to understand more deeply than utssys :-)

Signature · 4 lines
Matthew Wilcox <[email protected]>
"Windows and MacOS are products, contrived by engineers in the service of
specific companies. Unix, by contrast, is not so much a product as it is a
painstakingly compiled oral history of the hacker subculture." - N Stephenson
#1 lore raw
Quoted 6 lines

Can anyone tell me what the utssys() system call does? There's no manual page for it. From tusc, I can see:

utssys("HP-UX", 0, 0) ............................................ = 0

Just guessing but it might be for uname and setuname.

Dave

Signature · 2 lines
J. David Anglin                                  [email protected]
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)
#2 lore raw
In reply to Matthew Wilcox

Re:

Quoted 4 lines

Can anyone tell me what the utssys() system call does? There's no manual page for it. From tusc, I can see:

utssys("HP-UX", 0, 0) ............................................ = 0

#3 lore raw
Quoted 12 lines

Re:

Quoted 6 lines

Can anyone tell me what the utssys() system call does? There's no manual page for it. From tusc, I can see:

utssys("HP-UX", 0, 0) ............................................ = 0

From decompiling, it doesn't appear to do much. The kernel utssys

routine (called to handle system call (SYS_utssys, #57)), is short, with one external call ... to a short routine that has no procedure calls at all. That's where I stopped looking.

#4 lore raw
In reply to Matthew Wilcox
Quoted 2 lines · Matthew Wilcox

Can anyone tell me what the utssys() system call does? There's no manual page for it.

It takes 3 arguments; a pointer, and two ints.

The second int is the request type. If an unknown request type is passed in, it returns EFAULT.
If the request does something like sets the hostname, the first int passed in is the number of bytes in the hostname.
If the request does something like gets the hostname, the first int passed in is the size of the character buffer for it to put the answer in. Otherwise it's ignored.

type=0 gets the utsname (see sys/utsname.h). first int is ignored. type=1 is obsolete; it returns EFAULT
I don't know what type=2 does.
type=3 sets utsname.nodename, if you're root
type=4 sets the hostname, if you're root
type=5 gets the hostname
type=6 sets utsname.sysname, if you're root
type=7 is undocumented; it's only used during OS updates. Just return EFAULT.

Here's an example of using utssys() to get the system's hostname:

#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <syscall.h>
int main(argc,argv)
int argc; char *argv[];

{
    char buf[2048];
    memset(buf, 0, sizeof(buf));
    /*  utssys(buf, sizeof(buf), 5);  */
    if( syscall( SYS_UTSSYS, buf, sizeof(buf)-1, 5 ) == -1 ) {
        perror("utssys");
        exit(1);
    }
    printf("Hostname = \"%s\"\n", buf);
    exit(0);
}

- Kevin Vajk
<[email protected]>

#5 lore raw
Quoted 1 line · Kevin Vajk

I don't know what type=2 does.

Whoops! Yes, I do...

It implements ustat(). First argument is the dev, like this:
ustat(dev, buf) ==> utssys(buf, dev, 2)

- Kevin Vajk
<[email protected]>