update from main archive 970124
[glibc.git] / sysdeps / unix / sysv / linux / sparc / socket.S
blob24aba3fc742c3dd5ac8ef1f0489274be25a1dfed
1 /* Copyright (C) 1997 Free Software Foundation, Inc.
2    This file is part of the GNU C Library.
3    Contributed by Miguel de Icaza <miguel@gnu.ai.mit.edu>, 1997.
5    The GNU C Library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Library General Public License as
7    published by the Free Software Foundation; either version 2 of the
8    License, or (at your option) any later version.
10    The GNU C Library is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Library General Public License for more details.
15    You should have received a copy of the GNU Library General Public
16    License along with the GNU C Library; see the file COPYING.LIB.  If not,
17    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18    Boston, MA 02111-1307, USA.  */
20 #include <sysdep.h>
21 #include <sys/socketcall.h>
23 #define P(a, b) P2(a, b)
24 #define P2(a, b) a##b
26         .text
27 /* The socket-oriented system calls are handled unusually in Linux.
28    They are all gated through the single `socketcall' system call number.
29    `socketcall' takes two arguments: the first is the subcode, specifying
30    which socket function is being called; and the second is a pointer to
31    the arguments to the specific function.
33    The .S files for the other calls just #define socket and #include this.  */
35 .globl P(__,socket)
36 ENTRY (P(__,socket))
37         mov SYS_ify(socketcall), %g1    /* System call number */
39         /* Use ## so `socket' is a separate token that might be #define'd.  */
40         mov P(SOCKOP_,socket), %o0      /* Subcode is first arg to syscall.  */
41         mov %i0,%o1                     /* args pointer is second arg to syscall */
43         t 0x10
44         bcc,a   1
45         nop
46         save %sp,96,%sp
47         call __errno_location
48         nop
49         st %i0,[%o0]
50         restore
51         retl
52         mov -1,%o0
54         ret
56 PSEUDO_END (P(__,socket))
58 weak_alias (P(__,socket), socket)