comparison packages/net/tcpip/current/src/lib/write.c @ 97:ced4577552cd ecos-sw-2000-06-06

Merge from eCos master repository on 2000-06-06-08:44:00-BST
author jlarmour
date Tue, 06 Jun 2000 08:39:36 +0000
parents
children e0c0827131d1
comparison
equal deleted inserted replaced
96:b15c60e34c84 97:ced4577552cd
1 //==========================================================================
2 //
3 // lib/write.c
4 //
5 // write() system call
6 //
7 //==========================================================================
8 //####COPYRIGHTBEGIN####
9 //
10 // -------------------------------------------
11 // The contents of this file are subject to the Red Hat eCos Public License
12 // Version 1.1 (the "License"); you may not use this file except in
13 // compliance with the License. You may obtain a copy of the License at
14 // http://www.redhat.com/
15 //
16 // Software distributed under the License is distributed on an "AS IS"
17 // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
18 // License for the specific language governing rights and limitations under
19 // the License.
20 //
21 // The Original Code is eCos - Embedded Configurable Operating System,
22 // released September 30, 1998.
23 //
24 // The Initial Developer of the Original Code is Red Hat.
25 // Portions created by Red Hat are
26 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
27 // All Rights Reserved.
28 // -------------------------------------------
29 //
30 //####COPYRIGHTEND####
31 //####BSDCOPYRIGHTBEGIN####
32 //
33 // -------------------------------------------
34 //
35 // Portions of this software may have been derived from OpenBSD or other sources,
36 // and are covered by the appropriate copyright disclaimers included herein.
37 //
38 // -------------------------------------------
39 //
40 //####BSDCOPYRIGHTEND####
41 //==========================================================================
42 //#####DESCRIPTIONBEGIN####
43 //
44 // Author(s): gthomas
45 // Contributors: gthomas
46 // Date: 2000-01-10
47 // Purpose:
48 // Description:
49 //
50 //
51 //####DESCRIPTIONEND####
52 //
53 //==========================================================================
54
55
56 #include <sys/param.h>
57 #include <cyg/io/file.h>
58 #include <sys/socket.h>
59 #include <sys/socketvar.h>
60
61 #include <sys/syscallargs.h>
62
63 int
64 write(int fd, const void *buf, size_t len)
65 {
66 struct sys_write_args args;
67 int res, error;
68 SYSCALLARG(args,fd) = fd;
69 SYSCALLARG(args,buf) = buf;
70 SYSCALLARG(args,nbyte) = len;
71 error = sys_write(&args, &res);
72 if (error) {
73 errno = error;
74 return -1;
75 } else {
76 return res;
77 }
78 }