Mercurial > hg > octave-kai > gnulib-hg
annotate lib/spawn_faction_init.c @ 10690:01f3623813da
Split winsock.c into many smaller files.
* lib/close.c: Add _gl_close_fd_maybe_socket from winsock.c.
* lib/accept.c: New file, based on winsock.c.
* lib/bind.c: New file, based on winsock.c.
* lib/connect.c: New file, based on winsock.c.
* lib/getpeername.c: New file, based on winsock.c.
* lib/getsockname.c: New file, based on winsock.c.
* lib/getsockopt.c: New file, based on winsock.c.
* lib/ioctl.c: New file, based on winsock.c.
* lib/listen.c: New file, based on winsock.c.
* lib/recv.c: New file, based on winsock.c.
* lib/recvfrom.c: New file, based on winsock.c.
* lib/send.c: New file, based on winsock.c.
* lib/sendto.c: New file, based on winsock.c.
* lib/setsockopt.c: New file, based on winsock.c.
* lib/shutdown.c: New file, based on winsock.c.
* lib/socket.c: New file, based on winsock.c.
* lib/w32sock.h: New file, based on winsock.c.
* lib/winsock.c: Remove file.
* modules/accept: Likewise.
* modules/bind: Likewise.
* modules/connect: Likewise.
* modules/getpeername: Likewise.
* modules/getsockname: Likewise.
* modules/getsockopt: Likewise.
* modules/ioctl: Likewise.
* modules/listen: Likewise.
* modules/recv: Likewise.
* modules/recvfrom: Likewise.
* modules/send: Likewise.
* modules/sendto: Likewise.
* modules/setsockopt: Likewise.
* modules/shutdown: Likewise.
* modules/socket: Use socket.c instead of winsock.c.
* modules/sys_socket: Remove (unneeded?) dependency on winsock.c.
* doc/posix-functions/accept.texi: Doc fix.
* doc/posix-functions/bind.texi: Doc fix.
* doc/posix-functions/close.texi: Doc fix.
* doc/posix-functions/connect.texi: Doc fix.
* doc/posix-functions/getpeername.texi: Doc fix.
* doc/posix-functions/getsockname.texi: Doc fix.
* doc/posix-functions/getsockopt.texi: Doc fix.
* doc/posix-functions/ioctl.texi: Doc fix.
* doc/posix-functions/listen.texi: Doc fix.
* doc/posix-functions/recv.texi: Doc fix.
* doc/posix-functions/recvfrom.texi: Doc fix.
* doc/posix-functions/send.texi: Doc fix.
* doc/posix-functions/sendto.texi: Doc fix.
* doc/posix-functions/setsockopt.texi: Doc fix.
* doc/posix-functions/shutdown.texi: Doc fix.
* doc/posix-functions/socket.texi: Doc fix.
author | Simon Josefsson <simon@josefsson.org> |
---|---|
date | Tue, 21 Oct 2008 12:17:19 +0200 |
parents | 989d25db0548 |
children | e8d2c6fc33ad |
rev | line source |
---|---|
10506
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1 /* Copyright (C) 2000 Free Software Foundation, Inc. |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2 This file is part of the GNU C Library. |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3 |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4 This program is free software: you can redistribute it and/or modify |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5 it under the terms of the GNU General Public License as published by |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6 the Free Software Foundation; either version 3 of the License, or |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
7 (at your option) any later version. |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8 |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
9 This program is distributed in the hope that it will be useful, |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
10 but WITHOUT ANY WARRANTY; without even the implied warranty of |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
12 GNU General Public License for more details. |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
13 |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
14 You should have received a copy of the GNU General Public License |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
16 |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
17 #include <config.h> |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
18 |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
19 /* Specification. */ |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
20 #include <spawn.h> |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
21 |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
22 #include <errno.h> |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
23 #include <stdlib.h> |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
24 #include <string.h> |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
25 |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
26 #include "spawn_int.h" |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
27 |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
28 |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
29 /* Function used to increase the size of the allocated array. This |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
30 function is called from the `add'-functions. */ |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
31 int |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
32 __posix_spawn_file_actions_realloc (posix_spawn_file_actions_t *file_actions) |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
33 { |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
34 int newalloc = file_actions->_allocated + 8; |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
35 void *newmem = realloc (file_actions->_actions, |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
36 newalloc * sizeof (struct __spawn_action)); |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
37 |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
38 if (newmem == NULL) |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
39 /* Not enough memory. */ |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
40 return ENOMEM; |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
41 |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
42 file_actions->_actions = (struct __spawn_action *) newmem; |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
43 file_actions->_allocated = newalloc; |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
44 |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
45 return 0; |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
46 } |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
47 |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
48 |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
49 /* Initialize data structure for file attribute for `spawn' call. */ |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
50 int |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
51 posix_spawn_file_actions_init (posix_spawn_file_actions_t *file_actions) |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
52 { |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
53 /* Simply clear all the elements. */ |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
54 memset (file_actions, '\0', sizeof (*file_actions)); |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
55 return 0; |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
56 } |