revert between 56095 -> 55830 in arch
[AROS.git] / arch / all-mingw32 / bsdsocket / setsockopt.c
blob7eacde5300cf8fb5ea2d0ba287ecd7a8cbe2ec23
1 /*
2 Copyright © 2000-2010, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: English
7 */
9 #include "bsdsocket_intern.h"
10 #include "bsdsocket_util.h"
11 #include "socket_intern.h"
13 /*****************************************************************************
15 NAME */
17 AROS_LH5(int, setsockopt,
19 /* SYNOPSIS */
20 AROS_LHA(int, s, D0),
21 AROS_LHA(int, level, D1),
22 AROS_LHA(int, optname, D2),
23 AROS_LHA(void *, optval, A0),
24 AROS_LHA(int, optlen, D3),
26 /* LOCATION */
27 struct TaskBase *, taskBase, 15, BSDSocket)
29 /* FUNCTION
31 INPUTS
33 RESULT
35 NOTES
37 EXAMPLE
39 BUGS
41 SEE ALSO
43 INTERNALS
45 HISTORY
47 *****************************************************************************/
49 AROS_LIBFUNC_INIT
51 struct Socket *sd = GetSocket(s, taskBase);
52 int res = -1;
53 int err;
55 if (sd)
57 struct bsdsocketBase *SocketBase = taskBase->glob;
59 Forbid();
61 res = WSsetsockopt(sd->s, level, optname, optval, optlen);
62 if (res)
63 err = WSAGetLastError() - WSABASEERR;
65 Permit();
67 if (res)
68 SetError(err, taskBase);
71 return res;
73 AROS_LIBFUNC_EXIT
75 } /* setsockopt */