mirror of https://gitee.com/Nocallback/glibc.git
Browse Source
1998-06-01 Gordon Matzigkeit <gord@profitpress.com> * hurd/Makefile (routines): Add cthreads. 1998-05-31 Mark Kettenis <kettenis@phys.uva.nl> * login/login.c (login): Let pututline take care of finding the positin to insert the UTMP entry. This corrects a bug where ssh was not reusing UTMP entries marked as DEAD_PROCESS. Reported by Herbert Xu <herbert@gondor.apana.org.au>. 1998-05-31 Mark Kettenis <kettenis@phys.uva.nl> * login/Makefile (tests): New variable, add tst-utmp and tst-utmpx. * login/tst-utmp.c: New file. * login/tst-utmpx.c: New file. 1998-06-01 Gordon Matzigkeit <gord@profitpress.com> * sysdeps/mach/hurd/errlist.c (sys_nerr, _sys_nerr): Make weak aliases for _hurd_nerr, for programs that don't use sys_errlist, but need sys_err. 1998-05-31 Mark Kettenis <kettenis@phys.uva.nl> * sysdeps/generic/updwtmpx.c: Rename function to updwtmpx. * libc.map: Add updwtmpx and utmpxname to GLIBC_2.1. 1998-05-31 Mark Kettenis <kettenis@phys.uva.nl> * sysdeps/mach/hurd/read.c: Rename function to __libc_read and make __read a weak alias. Use ANSI-style function definition. * sysdeps/mach/hurd/write.c: Likewise. 1998-05-31 Mark Kettenis <kettenis@phys.uva.nl> * sysdeps/mach/hurd/err_hurd.sub: Use _hurd_errlist instead of _sys_errlist. 1998-05-30 Mark Kettenis <kettenis@phys.uva.nl> * sysdeps/mach/hurd/Makefile ($(objpfx)librtld.os): Renamed from librtld.so. 1998-06-02 Andreas Jaeger <aj@arthur.rhein-neckar.de> * libc.map: Remove _IO_getline_info which was erroneously introduced in section GLIBC_2.0. Noticed by Horst von Brand <vonbrand@sleipnir.valparaiso.cl>. 1998-06-01 Gordon Matzigkeit <gord@profitpress.com> * sysdeps/generic/socket.c (__socket): Renamed from socket, and created a weak alias. * sysdeps/mach/hurd/socket.c (__socket): Likewise. 1998-05-31 Gordon Matzigkeit <gord@profitpress.com> * sysdeps/mach/hurd/ftruncate.c (__ftruncate): Rename from old ftruncate function, and create a weak alias to ftruncate. 1998-06-01 Gordon Matzigkeit <gord@profitpress.com> * grp/fgetgrent_r.c: Use &errno instead of __errno_location (). * inet/getnetgrent_r.c: Likewise. * nss/getXXbyYY_r.c: Likewise. * nss/getXXent_r.c: Likewise. * pwd/fgetpwent_r.c: Likewise. * shadow/sgetspent_r.c: Likewise. * shadow/fgetspent_r.c: Likewise. * sunrpc/publickey.c: Likewise. 1998-06-01 Gordon Matzigkeit <gord@profitpress.com> * hurd/libhurduser.map: New file. * mach/libmachuser.map: Likewise. * libc.map: Add Hurd-specific functions to version 2.1. Add __flshfp and __fillbf. 1998-05-30 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * manual/signal.texi (Basic Signal Handling): Fix typo. * manual/errno.texi (Error Codes): Likewise. 1998-06-02 Ulrich Drepper <drepper@cygnus.com> * sysdeps/unix/sysv/linux/netipx/ipx.h: Include <bits/sockaddr.h> instead of <sys/socket.h>. Patch by NIIBE Yutaka <gniibe@mri.co.jp> * sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c (DL_FIND_ARG_COMPONENTS): Finally make it working. Patch by Mark Hatle <fray@kernel.crashing.org>. 1998-03-22 Paul Eggert <eggert@twinsun.com> * posix/regex.c: Include <wchar.h> before <wctype.h>, to work around a Solaris 2.6 bug.cvs/glibc-2-1-branch
33 changed files with 858 additions and 61 deletions
@ -0,0 +1,155 @@ |
|||
GLIBC_2.0 { |
|||
global: |
|||
|
|||
# These functions are used internally by libc. |
|||
_S_msg_server; __auth_getids; __auth_makeauth; |
|||
__auth_user_authenticate; __crash_dump_task; __dir_link; |
|||
__dir_lookup; __dir_mkdir; __dir_mkfile; __dir_readdir; |
|||
__dir_rename; __dir_rmdir; __dir_unlink; __exec_startup_get_info; |
|||
__file_check_access; __file_chflags; __file_chmod; __file_chown; |
|||
__file_exec; __file_getlinknode; __file_lock; __file_reparent; |
|||
__file_set_size; __file_set_translator; __file_statfs; |
|||
__file_sync; __file_syncfs; __file_utimes; __ifsock_getsockaddr; |
|||
__interrupt_operation; __io_clear_some_openmodes; |
|||
__io_get_icky_async_id; __io_get_openmodes; __io_get_owner; |
|||
__io_identity; __io_map; __io_mod_owner; __io_pathconf; __io_read; |
|||
__io_readable; __io_reauthenticate; __io_seek; __io_select; |
|||
__io_set_all_openmodes; __io_set_some_openmodes; __io_stat; |
|||
__io_write; __msg_set_init_int; __msg_sig_post; |
|||
__msg_sig_post_reply; __msg_sig_post_request; |
|||
__msg_sig_post_untraced; __msg_sig_post_untraced_reply; |
|||
__proc_child; __proc_dostop; __proc_get_arg_locations; |
|||
__proc_getallpids; __proc_getlogin; __proc_getmsgport; |
|||
__proc_getpgrp; __proc_getpgrppids; __proc_getpids; |
|||
__proc_getprivports; __proc_getprocinfo; __proc_getsid; |
|||
__proc_getsidport; __proc_handle_exceptions; __proc_mark_cont; |
|||
__proc_mark_exit; __proc_mark_stop; __proc_mark_traced; |
|||
__proc_mod_stopchild; __proc_pid2task; __proc_reauthenticate; |
|||
__proc_set_arg_locations; __proc_setlogin; __proc_setmsgport; |
|||
__proc_setowner; __proc_setpgrp; __proc_setsid; __proc_task2pid; |
|||
__proc_task2proc; __proc_uname; __proc_wait; __socket_accept; |
|||
__socket_bind; __socket_connect; __socket_connect2; |
|||
__socket_create; __socket_create_address; __socket_getopt; |
|||
__socket_listen; __socket_name; __socket_peername; __socket_recv; |
|||
__socket_send; __socket_setopt; __socket_shutdown; |
|||
__socket_whatis_address; __startup_reboot; __term_get_nodename; |
|||
__term_getctty; __term_open_ctty; __termctty_open_terminal; |
|||
__tioctl_tiocspgrp; _hurdsig_fault_exc_server; |
|||
|
|||
# functions in normal name space |
|||
# Please keep them sorted by name! |
|||
|
|||
# a* |
|||
auth_getids; auth_makeauth; auth_server_authenticate; |
|||
auth_user_authenticate; |
|||
|
|||
# c* |
|||
crash_dump_task; |
|||
|
|||
# d* |
|||
dir_link; dir_lookup; dir_mkdir; dir_mkfile; dir_notice_changes; |
|||
dir_readdir; dir_rename; dir_rmdir; dir_unlink; |
|||
|
|||
# e* |
|||
exec_exec; exec_init; exec_setexecdata; exec_startup_get_info; |
|||
|
|||
# f* |
|||
file_chauthor; file_check_access; file_chflags; file_chmod; |
|||
file_chown; file_exec; file_get_fs_options; file_get_storage_info; |
|||
file_get_translator; file_get_translator_cntl; file_getcontrol; |
|||
file_getfh; file_getlinknode; file_lock; file_lock_stat; |
|||
file_notice_changes; file_reparent; file_set_size; |
|||
file_set_translator; file_statfs; file_sync; file_syncfs; |
|||
file_utimes; fsys_forward; fsys_get_options; fsys_getfile; |
|||
fsys_getpriv; fsys_getroot; fsys_goaway; fsys_init; |
|||
fsys_set_options; fsys_startup; fsys_syncfs; |
|||
|
|||
# i* |
|||
ifsock_getsockaddr; interrupt_operation; io_async; |
|||
io_clear_some_openmodes; io_duplicate; io_eofnotify; io_get_conch; |
|||
io_get_icky_async_id; io_get_openmodes; io_get_owner; io_identity; |
|||
io_map; io_map_cntl; io_mod_owner; io_pathconf; io_postnotify; |
|||
io_prenotify; io_read; io_readable; io_readnotify; io_readsleep; |
|||
io_reauthenticate; io_release_conch; io_restrict_auth; io_seek; |
|||
io_select; io_server_version; io_set_all_openmodes; |
|||
io_set_some_openmodes; io_sigio; io_stat; io_write; |
|||
|
|||
# m* |
|||
msg_add_auth; msg_del_auth; msg_describe_ports; msg_get_dtable; |
|||
msg_get_env_variable; msg_get_environment; msg_get_fd; |
|||
msg_get_init_int; msg_get_init_ints; msg_get_init_port; |
|||
msg_get_init_ports; msg_proc_newids; msg_report_wait; |
|||
msg_set_dtable; msg_set_env_variable; msg_set_environment; |
|||
msg_set_fd; msg_set_init_int; msg_set_init_ints; |
|||
msg_set_init_port; msg_set_init_ports; msg_sig_post; |
|||
msg_sig_post_reply; msg_sig_post_request; msg_sig_post_untraced; |
|||
msg_sig_post_untraced_reply; msg_sig_post_untraced_request; |
|||
|
|||
# p* |
|||
proc_child; proc_child_request; proc_dostop; proc_dostop_request; |
|||
proc_execdata_notify; proc_execdata_notify_request; |
|||
proc_get_arg_locations; proc_get_arg_locations_request; |
|||
proc_get_tty; proc_get_tty_request; proc_getallpids; |
|||
proc_getallpids_request; proc_getexecdata; |
|||
proc_getexecdata_request; proc_gethostid_request; |
|||
proc_gethostname_request; proc_getlogin; proc_getlogin_request; |
|||
proc_getloginid; proc_getloginid_request; proc_getloginpids; |
|||
proc_getloginpids_request; proc_getmsgport; |
|||
proc_getmsgport_request; proc_getpgrp; proc_getpgrp_request; |
|||
proc_getpgrppids; proc_getpgrppids_request; proc_getpids; |
|||
proc_getpids_request; proc_getprivports; |
|||
proc_getprivports_request; proc_getprocargs; |
|||
proc_getprocargs_request; proc_getprocenv; |
|||
proc_getprocenv_request; proc_getprocinfo; |
|||
proc_getprocinfo_request; proc_getsessionpgids; |
|||
proc_getsessionpgids_request; proc_getsessionpids; |
|||
proc_getsessionpids_request; proc_getsid; proc_getsid_request; |
|||
proc_getsidport; proc_getsidport_request; proc_handle_exceptions; |
|||
proc_handle_exceptions_request; proc_make_login_coll; |
|||
proc_make_login_coll_request; proc_mark_cont; |
|||
proc_mark_cont_request; proc_mark_exec; proc_mark_exec_request; |
|||
proc_mark_exit; proc_mark_exit_request; proc_mark_stop; |
|||
proc_mark_stop_request; proc_mark_traced; |
|||
proc_mark_traced_request; proc_mod_stopchild; |
|||
proc_mod_stopchild_request; proc_pid2proc; proc_pid2proc_request; |
|||
proc_pid2task; proc_pid2task_request; proc_proc2task; |
|||
proc_proc2task_request; proc_reassign; proc_reassign_request; |
|||
proc_reauthenticate; proc_reauthenticate_request; |
|||
proc_register_version; proc_register_version_request; |
|||
proc_set_arg_locations; proc_set_arg_locations_request; |
|||
proc_setexecdata; proc_setexecdata_request; |
|||
proc_sethostid_request; proc_sethostname_request; proc_setlogin; |
|||
proc_setlogin_request; proc_setmsgport; proc_setmsgport_request; |
|||
proc_setowner; proc_setowner_request; proc_setpgrp; |
|||
proc_setpgrp_request; proc_setsid; proc_setsid_request; |
|||
proc_task2pid; proc_task2pid_request; proc_task2proc; |
|||
proc_task2proc_request; proc_uname; proc_uname_request; proc_wait; |
|||
proc_wait_request; |
|||
|
|||
# s* |
|||
socket_accept; socket_bind; socket_connect; socket_connect2; |
|||
socket_create; socket_create_address; socket_fabricate_address; |
|||
socket_getopt; socket_listen; socket_name; socket_peername; |
|||
socket_recv; socket_send; socket_setopt; socket_shutdown; |
|||
socket_whatis_address; startup_authinit; startup_essential_task; |
|||
startup_procinit; startup_reboot; startup_request_notification; |
|||
|
|||
# t* |
|||
term_get_bottom_type; term_get_nodename; term_getctty; |
|||
term_on_hurddev; term_on_machdev; term_on_pty; term_open_ctty; |
|||
term_set_filenode; term_set_nodename; termctty_open_terminal; |
|||
tioctl_tioccbrk; tioctl_tioccdtr; tioctl_tiocdrain; |
|||
tioctl_tiocexcl; tioctl_tiocext; tioctl_tiocflush; |
|||
tioctl_tiocgeta; tioctl_tiocgetd; tioctl_tiocgpgrp; |
|||
tioctl_tiocgwinsz; tioctl_tiocmbic; tioctl_tiocmbis; |
|||
tioctl_tiocmget; tioctl_tiocmodg; tioctl_tiocmods; |
|||
tioctl_tiocmset; tioctl_tiocnxcl; tioctl_tiocoutq; tioctl_tiocpkt; |
|||
tioctl_tiocremote; tioctl_tiocsbrk; tioctl_tiocsdtr; |
|||
tioctl_tiocseta; tioctl_tiocsetaf; tioctl_tiocsetaw; |
|||
tioctl_tiocsetd; tioctl_tiocsig; tioctl_tiocspgrp; |
|||
tioctl_tiocstart; tioctl_tiocsti; tioctl_tiocstop; |
|||
tioctl_tiocswinsz; tioctl_tiocucntl; |
|||
|
|||
local: |
|||
*; |
|||
}; |
|||
@ -0,0 +1,113 @@ |
|||
# libmachuser.map - symbol version and export information for libmachuser.so |
|||
GLIBC_2.0 { |
|||
global: |
|||
|
|||
# These functions are used internally by libc. |
|||
_S_exc_server; __host_adjust_time; __host_get_time; __host_info; |
|||
__host_set_time; __mach_port_allocate_name_rpc; |
|||
__mach_port_allocate_rpc; __mach_port_deallocate_rpc; |
|||
__mach_port_destroy; __mach_port_extract_right; |
|||
__mach_port_get_refs; __mach_port_insert_right_rpc; |
|||
__mach_port_mod_refs; __mach_port_move_member; __mach_port_names; |
|||
__mach_port_set_qlimit; __task_create_rpc; |
|||
__task_disable_pc_sampling; __task_enable_pc_sampling; |
|||
__task_get_special_port; __task_priority; __task_resume; |
|||
__task_set_special_port_rpc; __task_suspend_rpc; |
|||
__task_terminate_rpc; __task_threads; __thread_abort; |
|||
__thread_create; __thread_depress_abort_rpc; __thread_get_state; |
|||
__thread_resume; __thread_set_special_port; __thread_set_state; |
|||
__thread_suspend; __thread_terminate; __vm_allocate_rpc; |
|||
__vm_deallocate_rpc; __vm_map_rpc; __vm_protect; __vm_read; |
|||
__vm_region; __vm_statistics; __vm_write; |
|||
|
|||
# functions in normal name space |
|||
# Please keep them sorted by name! |
|||
|
|||
# d* |
|||
default_pager_info; default_pager_object_create; |
|||
default_pager_object_pages; default_pager_objects; |
|||
default_pager_paging_file; default_pager_register_fileserver; |
|||
device_close; device_get_status; device_map; device_open; |
|||
device_open_request; device_read; device_read_inband; |
|||
device_read_request; device_read_request_inband; device_set_filter; |
|||
device_set_status; device_write; device_write_inband; |
|||
device_write_request; device_write_request_inband; |
|||
dp_helper_paging_space; |
|||
|
|||
# e* |
|||
exception_raise; |
|||
|
|||
# h* |
|||
host_adjust_time; host_get_boot_info; host_get_time; host_info; |
|||
host_kernel_version; host_processor_set_priv; host_processor_sets; |
|||
host_processors; host_reboot; host_set_time; |
|||
|
|||
# m* |
|||
mach_port_allocate_name_rpc; mach_port_allocate_rpc; |
|||
mach_port_deallocate_rpc; mach_port_destroy; |
|||
mach_port_extract_right; mach_port_get_receive_status; |
|||
mach_port_get_refs; mach_port_get_set_status; |
|||
mach_port_insert_right_rpc; mach_port_mod_refs; |
|||
mach_port_move_member; mach_port_names; mach_port_rename; |
|||
mach_port_request_notification; mach_port_set_mscount; |
|||
mach_port_set_qlimit; mach_port_set_seqno; mach_port_type; |
|||
mach_ports_lookup; mach_ports_register; |
|||
memory_object_change_attributes; memory_object_change_completed; |
|||
memory_object_copy; memory_object_create; |
|||
memory_object_data_error; memory_object_data_initialize; |
|||
memory_object_data_provided; memory_object_data_request; |
|||
memory_object_data_return; memory_object_data_supply; |
|||
memory_object_data_unavailable; memory_object_data_unlock; |
|||
memory_object_data_write; memory_object_destroy; |
|||
memory_object_get_attributes; memory_object_init; |
|||
memory_object_lock_completed; memory_object_lock_request; |
|||
memory_object_ready; memory_object_set_attributes; |
|||
memory_object_supply_completed; memory_object_terminate; |
|||
|
|||
# o* |
|||
old_mach_port_get_receive_status; |
|||
|
|||
# p* |
|||
processor_assign; processor_control; processor_exit; |
|||
processor_get_assignment; processor_info; processor_set_create; |
|||
processor_set_default; processor_set_destroy; processor_set_info; |
|||
processor_set_max_priority; processor_set_policy_disable; |
|||
processor_set_policy_enable; processor_set_tasks; |
|||
processor_set_threads; processor_start; |
|||
|
|||
# t* |
|||
task_assign; task_assign_default; task_create_rpc; |
|||
task_disable_pc_sampling; task_enable_pc_sampling; |
|||
task_get_assignment; task_get_emulation_vector; |
|||
task_get_sampled_pcs; task_get_special_port; task_info; |
|||
task_priority; task_ras_control; task_resume; task_set_emulation; |
|||
task_set_emulation_vector; task_set_special_port_rpc; |
|||
task_suspend_rpc; task_terminate_rpc; task_threads; thread_abort; |
|||
thread_assign; thread_assign_default; thread_create; |
|||
thread_depress_abort_rpc; thread_disable_pc_sampling; |
|||
thread_enable_pc_sampling; thread_get_assignment; |
|||
thread_get_sampled_pcs; thread_get_special_port; thread_get_state; |
|||
thread_info; thread_max_priority; thread_policy; thread_priority; |
|||
thread_resume; thread_set_special_port; thread_set_state; |
|||
thread_suspend; thread_terminate; thread_wire; |
|||
|
|||
# v* |
|||
vm_allocate_rpc; vm_copy; vm_deallocate_rpc; vm_inherit; |
|||
vm_machine_attribute; vm_map_rpc; vm_protect; vm_read; vm_region; |
|||
vm_set_default_memory_manager; vm_statistics; vm_wire; vm_write; |
|||
|
|||
# x* |
|||
xxx_cpu_control; xxx_device_get_status; xxx_device_set_filter; |
|||
xxx_device_set_status; xxx_host_info; |
|||
xxx_memory_object_lock_request; xxx_processor_set_default_priv; |
|||
xxx_slot_info; xxx_task_get_emulation_vector; xxx_task_info; |
|||
xxx_task_set_emulation_vector; xxx_thread_get_state; |
|||
xxx_thread_info; xxx_thread_set_state; |
|||
|
|||
# y* |
|||
yyy_host_info; yyy_processor_control; yyy_processor_info; |
|||
yyy_processor_set_info; |
|||
|
|||
local: |
|||
*; |
|||
}; |
|||
@ -0,0 +1,380 @@ |
|||
/* Tests for UTMP functions.
|
|||
Copyright (C) 1998 Free Software Foundation, Inc. |
|||
Contributed by Mark Kettenis <kettenis@phys.uva.nl>, 1998. |
|||
|
|||
The GNU C Library is free software; you can redistribute it and/or |
|||
modify it under the terms of the GNU Library General Public License as |
|||
published by the Free Software Foundation; either version 2 of the |
|||
License, or (at your option) any later version. |
|||
|
|||
The GNU C Library is distributed in the hope that it will be useful, |
|||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|||
Library General Public License for more details. |
|||
|
|||
You should have received a copy of the GNU Library General Public |
|||
License along with the GNU C Library; see the file COPYING.LIB. If not, |
|||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
|||
Boston, MA 02111-1307, USA. */ |
|||
|
|||
#include <errno.h> |
|||
#include <error.h> |
|||
#include <stdlib.h> |
|||
#include <string.h> |
|||
#include <sys/types.h> |
|||
#include <time.h> |
|||
|
|||
#ifdef UTMPX |
|||
# include <utmpx.h> |
|||
# define utmp utmpx |
|||
# define utmpname utmpxname |
|||
# define setutent setutxent |
|||
# define getutent getutxent |
|||
# define endutent endutxent |
|||
# define getutline getutxline |
|||
# define getutid getutxid |
|||
# define pututline pututxline |
|||
#else |
|||
# include <utmp.h> |
|||
#endif |
|||
|
|||
|
|||
/* Prototype for our test function. */ |
|||
static int do_test (int argc, char *argv[]); |
|||
|
|||
/* We have a preparation function. */ |
|||
static void do_prepare (int argc, char *argv[]); |
|||
#define PREPARE do_prepare |
|||
|
|||
/* This defines the `main' function and some more. */ |
|||
#include <test-skeleton.c> |
|||
|
|||
|
|||
/* These are for the temporary file we generate. */ |
|||
char *name; |
|||
int fd; |
|||
|
|||
static void |
|||
do_prepare (int argc, char *argv[]) |
|||
{ |
|||
size_t name_len; |
|||
|
|||
name_len = strlen (test_dir); |
|||
name = malloc (name_len + sizeof ("/utmpXXXXXX")); |
|||
mempcpy (mempcpy (name, test_dir, name_len), |
|||
"/utmpXXXXXX", sizeof ("/utmpXXXXXX")); |
|||
add_temp_file (name); |
|||
|
|||
/* Open our test file. */ |
|||
fd = mkstemp (name); |
|||
if (fd == -1) |
|||
error (EXIT_FAILURE, errno, "cannot open test file `%s'", name); |
|||
} |
|||
|
|||
|
|||
struct utmp entry[] = |
|||
{ |
|||
{ ut_type: BOOT_TIME, ut_pid: 1, ut_tv: { tv_sec: 1000 } }, |
|||
{ ut_type: RUN_LVL, ut_pid: 1, ut_tv: { tv_sec: 2000 } }, |
|||
{ ut_type: INIT_PROCESS, ut_pid: 5, ut_id: "si", ut_tv: { tv_sec: 3000 } }, |
|||
{ ut_type: LOGIN_PROCESS, ut_pid: 23, ut_line: "tty1", ut_id: "1", |
|||
ut_user: "LOGIN", ut_session: 23, ut_tv: { tv_sec: 4000 } }, |
|||
{ ut_type: USER_PROCESS, ut_pid: 24, ut_line: "tty2", ut_id: "2", |
|||
ut_user: "albert", ut_session: 24, ut_tv: { tv_sec: 8000 } }, |
|||
{ ut_type: USER_PROCESS, ut_pid: 196, ut_line: "ttyp0", ut_id: "p0", |
|||
ut_user: "niels", ut_session: 196, ut_tv: { tv_sec: 10000 } }, |
|||
{ ut_type: DEAD_PROCESS, ut_line: "ttyp1", ut_id: "p1", |
|||
ut_tv: { tv_sec: 16000 } }, |
|||
{ ut_type: EMPTY }, |
|||
{ ut_type: EMPTY } |
|||
}; |
|||
int num_entries = sizeof entry / sizeof (struct utmp); |
|||
|
|||
time_t entry_time = 20000; |
|||
pid_t entry_pid = 234; |
|||
|
|||
static int |
|||
do_init (void) |
|||
{ |
|||
int n; |
|||
|
|||
setutent (); |
|||
|
|||
for (n = 0; n < num_entries; n++) |
|||
{ |
|||
if (pututline (&entry[n]) == NULL) |
|||
{ |
|||
error (0, errno, "cannot write UTMP entry"); |
|||
return 1; |
|||
} |
|||
} |
|||
|
|||
endutent (); |
|||
|
|||
return 0; |
|||
} |
|||
|
|||
|
|||
static int |
|||
do_check (void) |
|||
{ |
|||
struct utmp *ut; |
|||
int n; |
|||
|
|||
setutent (); |
|||
|
|||
n = 0; |
|||
while ((ut = getutent ())) |
|||
{ |
|||
if (n < num_entries && |
|||
memcmp (ut, &entry[n], sizeof (struct utmp))) |
|||
{ |
|||
error (0, 0, "UTMP entry does not match"); |
|||
return 1; |
|||
} |
|||
|
|||
n++; |
|||
} |
|||
|
|||
if (n != num_entries) |
|||
{ |
|||
error (0, 0, "number of UTMP entries is incorrect"); |
|||
return 1; |
|||
} |
|||
|
|||
endutent (); |
|||
|
|||
return 0; |
|||
} |
|||
|
|||
static int |
|||
simulate_login (const char *line, const char *user) |
|||
{ |
|||
int n; |
|||
|
|||
for (n = 0; n < num_entries; n++) |
|||
{ |
|||
if (strcmp (line, entry[n].ut_line) == 0 || |
|||
entry[n].ut_type == DEAD_PROCESS) |
|||
{ |
|||
if (entry[n].ut_pid == DEAD_PROCESS) |
|||
entry[n].ut_pid = (entry_pid += 27); |
|||
entry[n].ut_type = USER_PROCESS; |
|||
strcpy (entry[n].ut_user, user); |
|||
entry[n].ut_tv.tv_sec = (entry_time += 1000); |
|||
|
|||
setutent (); |
|||
|
|||
if (pututline (&entry[n]) == NULL) |
|||
{ |
|||
error (0, errno, "cannot write UTMP entry"); |
|||
return 1; |
|||
} |
|||
|
|||
endutent (); |
|||
|
|||
return 0; |
|||
} |
|||
} |
|||
|
|||
error (0, 0, "no entries available"); |
|||
return 1; |
|||
} |
|||
|
|||
static int |
|||
simulate_logout (const char *line) |
|||
{ |
|||
int n; |
|||
|
|||
for (n = 0; n < num_entries; n++) |
|||
{ |
|||
if (strcmp (line, entry[n].ut_line) == 0) |
|||
{ |
|||
entry[n].ut_type = DEAD_PROCESS; |
|||
entry[n].ut_user[0] = '\0'; |
|||
entry[n].ut_tv.tv_sec = (entry_time += 1000); |
|||
|
|||
setutent (); |
|||
|
|||
if (pututline (&entry[n]) == NULL) |
|||
{ |
|||
error (0, errno, "cannot write UTMP entry"); |
|||
return 1; |
|||
} |
|||
|
|||
endutent (); |
|||
|
|||
return 0; |
|||
} |
|||
} |
|||
|
|||
error (0, 0, "no entry found for `%s'", line); |
|||
return 1; |
|||
} |
|||
|
|||
static int |
|||
check_login (const char *line) |
|||
{ |
|||
struct utmp *up; |
|||
struct utmp ut; |
|||
int n; |
|||
|
|||
setutent (); |
|||
|
|||
strcpy (ut.ut_line, line); |
|||
up = getutline (&ut); |
|||
if (up == NULL) |
|||
{ |
|||
error (0, errno, "cannot get entry for line `%s'", line); |
|||
return 1; |
|||
} |
|||
|
|||
endutent (); |
|||
|
|||
for (n = 0; n < num_entries; n++) |
|||
{ |
|||
if (strcmp (line, entry[n].ut_line) == 0) |
|||
{ |
|||
if (memcmp (up, &entry[n], sizeof (struct utmp))) |
|||
{ |
|||
error (0, 0, "UTMP entry does not match"); |
|||
return 1; |
|||
} |
|||
|
|||
return 0; |
|||
} |
|||
} |
|||
|
|||
error (0, 0, "bogus entry for line `%s'", line); |
|||
return 1; |
|||
} |
|||
|
|||
static int |
|||
check_logout (const char *line) |
|||
{ |
|||
struct utmp ut; |
|||
|
|||
setutent (); |
|||
|
|||
strcpy (ut.ut_line, line); |
|||
if (getutline (&ut) != NULL) |
|||
{ |
|||
error (0, 0, "bogus login entry for `%s'", line); |
|||
return 1; |
|||
} |
|||
|
|||
endutent (); |
|||
|
|||
return 0; |
|||
} |
|||
|
|||
static int |
|||
check_id (const char *id) |
|||
{ |
|||
struct utmp *up; |
|||
struct utmp ut; |
|||
int n; |
|||
|
|||
setutent (); |
|||
|
|||
ut.ut_type = USER_PROCESS; |
|||
strcpy (ut.ut_id, id); |
|||
up = getutid (&ut); |
|||
if (up == NULL) |
|||
{ |
|||
error (0, errno, "cannot get entry for ID `%s'", id); |
|||
return 1; |
|||
} |
|||
|
|||
endutent (); |
|||
|
|||
for (n = 0; n < num_entries; n++) |
|||
{ |
|||
if (strcmp (id, entry[n].ut_id) == 0) |
|||
{ |
|||
if (memcmp (up, &entry[n], sizeof (struct utmp))) |
|||
{ |
|||
error (0, 0, "UTMP entry does not match"); |
|||
return 1; |
|||
} |
|||
|
|||
return 0; |
|||
} |
|||
} |
|||
|
|||
error (0, 0, "bogus entry for ID `%s'", id); |
|||
return 1; |
|||
} |
|||
|
|||
static int |
|||
check_type (int type) |
|||
{ |
|||
struct utmp *up; |
|||
struct utmp ut; |
|||
int n; |
|||
|
|||
setutent (); |
|||
|
|||
ut.ut_type = type; |
|||
up = getutid (&ut); |
|||
if (up == NULL) |
|||
{ |
|||
error (0, errno, "cannot get entry for type `%d'", type); |
|||
return 1; |
|||
} |
|||
|
|||
endutent (); |
|||
|
|||
for (n = 0; n < num_entries; n++) |
|||
{ |
|||
if (type == entry[n].ut_type) |
|||
{ |
|||
if (memcmp (up, &entry[n], sizeof (struct utmp))) |
|||
{ |
|||
error (0, 0, "UTMP entry does not match"); |
|||
return 1; |
|||
} |
|||
|
|||
return 0; |
|||
} |
|||
} |
|||
|
|||
error (0, 0, "bogus entry for type `%d'", type); |
|||
return 1; |
|||
} |
|||
|
|||
static int |
|||
do_test (int argc, char *argv[]) |
|||
{ |
|||
int result = 0; |
|||
|
|||
utmpname (name); |
|||
|
|||
result |= do_init (); |
|||
result |= do_check (); |
|||
|
|||
result |= simulate_login ("tty1", "erwin"); |
|||
result |= do_check (); |
|||
|
|||
result |= simulate_login ("ttyp1", "paul"); |
|||
result |= do_check (); |
|||
|
|||
result |= simulate_logout ("tty2"); |
|||
result |= do_check (); |
|||
|
|||
result |= simulate_logout ("ttyp0"); |
|||
result |= do_check (); |
|||
|
|||
result |= simulate_login ("ttyp2", "richard"); |
|||
result |= do_check (); |
|||
|
|||
result |= check_login ("tty1"); |
|||
result |= check_logout ("ttyp0"); |
|||
result |= check_id ("p1"); |
|||
result |= check_id ("2"); |
|||
result |= check_id ("si"); |
|||
result |= check_type (BOOT_TIME); |
|||
result |= check_type (RUN_LVL); |
|||
|
|||
return result; |
|||
} |
|||
@ -0,0 +1,2 @@ |
|||
#define UTMPX |
|||
#include "tst-utmp.c" |
|||
@ -1,11 +1,12 @@ |
|||
/* This file defines the Mach error system for Hurd server errors. */ |
|||
|
|||
#include <stdio.h> |
|||
#include <errno.h> |
|||
|
|||
extern const char *const _hurd_errlist[]; |
|||
|
|||
/* Omit `const' because we are included with `static' |
|||
defined to `static const'. */ |
|||
static struct error_subsystem err_hurd_sub[] = |
|||
{ |
|||
{ "(os/hurd)", _HURD_ERRNOS, (const char *const *) _sys_errlist }, |
|||
{ "(os/hurd)", _HURD_ERRNOS, (const char *const *) _hurd_errlist }, |
|||
}; |
|||
|
|||
Loading…
Reference in new issue